Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic javascript question

Status
Not open for further replies.

GezH

Programmer
Aug 7, 2002
68
Please could someone explain what the following line in my page does?

<script type="text/javascript" language="JavaScript" href="/somedir/somefile.js"></script>

Does it actually execute the file specified, or does it just make available the file and hence any functions held within it?

Thanks!
 
Does it actually execute the file specified, or does it just make available the file and hence any functions held within it?
Yes and yes.

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
The statement you used as an example includes the JS file on the page as it loads. If there is code that executes outside of a function, then that will execute when the JS file is loaded.

Lee
 
Thanks...

Actually I made a mistake... I should have used the 'src' attribute not the 'href'....as shown:

<script language="JavaScript" type="text/JavaScript" src="/somedir/somefile.js"></script>

I presume this is the same consequence?

Thanks again.
 
Those correct responses are meant for src. href is truly a mistake and it won't execute and won't be made available to the page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top