Empty <SCRIPT> Tags Required?

J

Jeffrey T.

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>
 
S

Scott M.

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?
 
S

Scott M.

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top