473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Empty <SCRIPT> Tags Required?

I had some JavaScript functions defined in the <SCRIPT> section at the top
of an aspx page (tested fine there).

I then moved the JavaScript functions to their own separate file and then
referenced that file in the <HEAD> section of the aspx page.

I then removed the <SCRIPT> section from the aspx page, and the JavaScript
stopped working (it was getting called, but some functionality wasn't
working). I verified the path and file name to the new JavaScript file.
Ultimately I found that everything works fine as long as a <SCRIPT> section
exists in the <HEAD> of the aspx page. The script section can be completely
empty and everything will work just fine. Remove it and some of the
JavaScript functionality disappears.

Is this normal, or am I missing something. The following is the entire HEAD
section of the aspx file in question.

<HEAD>
<TITLE>Site Organizer</TITLE>
<link rel="stylesheet" href="css/admin.css" type="text/css">
<script type="text/javascript" src="scripts/treelogic.js">
<SCRIPT type="text/javascript">

</SCRIPT>
</HEAD>

Nov 18 '05 #1
2 1538
The "empty" script tag is serving a purpose. Don't you see that it is
referencing the file called treelogic.js, where there is more JavaScript
that is now available because of the reference to it?
"Jeffrey T." <CR***@CR250.com> wrote in message
news:e5**************@TK2MSFTNGP11.phx.gbl...
I had some JavaScript functions defined in the <SCRIPT> section at the top
of an aspx page (tested fine there).

I then moved the JavaScript functions to their own separate file and then
referenced that file in the <HEAD> section of the aspx page.

I then removed the <SCRIPT> section from the aspx page, and the JavaScript
stopped working (it was getting called, but some functionality wasn't
working). I verified the path and file name to the new JavaScript file.
Ultimately I found that everything works fine as long as a <SCRIPT> section exists in the <HEAD> of the aspx page. The script section can be completely empty and everything will work just fine. Remove it and some of the
JavaScript functionality disappears.

Is this normal, or am I missing something. The following is the entire HEAD section of the aspx file in question.

<HEAD>
<TITLE>Site Organizer</TITLE>
<link rel="stylesheet" href="css/admin.css" type="text/css">
<script type="text/javascript" src="scripts/treelogic.js">
<SCRIPT type="text/javascript">

</SCRIPT>
</HEAD>

Nov 18 '05 #2
And, you've nested your script tags improperly. It should be:

<HEAD>
<TITLE>Site Organizer</TITLE>
<link rel="stylesheet" href="css/admin.css" type="text/css">
<script type="text/javascript" src="scripts/treelogic.js"></script>
</HEAD>

"Scott M." <No****@NoSpam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
The "empty" script tag is serving a purpose. Don't you see that it is
referencing the file called treelogic.js, where there is more JavaScript
that is now available because of the reference to it?
"Jeffrey T." <CR***@CR250.com> wrote in message
news:e5**************@TK2MSFTNGP11.phx.gbl...
I had some JavaScript functions defined in the <SCRIPT> section at the top of an aspx page (tested fine there).

I then moved the JavaScript functions to their own separate file and then referenced that file in the <HEAD> section of the aspx page.

I then removed the <SCRIPT> section from the aspx page, and the JavaScript stopped working (it was getting called, but some functionality wasn't
working). I verified the path and file name to the new JavaScript file.
Ultimately I found that everything works fine as long as a <SCRIPT>

section
exists in the <HEAD> of the aspx page. The script section can be

completely
empty and everything will work just fine. Remove it and some of the
JavaScript functionality disappears.

Is this normal, or am I missing something. The following is the entire

HEAD
section of the aspx file in question.

<HEAD>
<TITLE>Site Organizer</TITLE>
<link rel="stylesheet" href="css/admin.css" type="text/css">
<script type="text/javascript" src="scripts/treelogic.js">
<SCRIPT type="text/javascript">

</SCRIPT>
</HEAD>


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Madhav | last post by:
I have the following statements in my script. ---------------------------------------------------------- textToWrite = "<HTML> \n" + "<HEAD> \n" + "<TITLE>Calendar</TITLE> \n" + "<SCRIPT...
6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
1
by: D. Shane Fowlkes | last post by:
I'm a fairly skilled traditional ASP/VB programmer and am learning .NET. I was (recently) surprised to read in a book about declaring and defining all my page Functions in <script...
1
by: andrew | last post by:
So I spent ages trying to work out what the problem was with my code when I did this and found a post which led me to the very simple solution. I use WebMatrix so I'm not sure if this is a major...
21
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript"...
12
by: Iddo | last post by:
Hi, I am having a strange problem... I have an HTML file which has 2 script tags: 1) <script language="javascript" id="ABC" src="ABC.js" /> 2) <script id="general" language="javascript">...
44
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
4
by: Alex Maghen | last post by:
When I do this in my page... ClientScript.RegisterStartupScript(this.GetType(), "SomeScript", "alert(\"Hi there\");"); it doesn't work AND when I view source, the alert() line is dumped into the...
2
by: bilaribilari | last post by:
Hi all, I am using Tidy (C) for parsing html pages. I encountered a page that has some script as follows: <script> .... var abc = "<script>some stuff here</" + "script>"; .... </script>
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.