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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Javascript?

Status
Not open for further replies.

hepower

Technical User
May 16, 2001
10
US
I understand that I can execute code in a .js file at a certain location in my html file by <javascript src=...> type code but, how can I execute certain code in the external file if it's not in a function and I have more than just one set of instructions in that file? Can I do this? i.e. I have an applet code that I wish to run in 2 different places in my html file. They will use different parameters. Instead of writing 2 different .js files with a bunch of doc.writelines in each, how can I put them both into one file and just execute the portion that's needed at either place in my html file? Hope I've explained this well enough. Thank you
 
>>..if it's not in a function..

why so? make 2 different functions, put them in one .js file & call whenever you want..

i'm shure you know this, but you shouldn't use document.write after page parsing. (i.e. when page was completely loaded) Victor
 
No, I didn't know that. Thanks for the info.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top