By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 1,973 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

Empty <SCRIPT> Tags Required?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.