I am facing problem while using external javascript file. My html page contains following code in the body section
script src="localpath\abc.js" var start = starttimestamp(); alert("hi") var endtime = endtimestamp(); timestamp(start,endtime)
now my js file abc.js contains 3 functions starttimestamp,endtimestamp,timestamp (it doesnt contain script tag)
but when i try to load html page nothing happens...actually function shud execute and write the result.
why this is happening?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
Is the JS file actually being found? Try putting an alert(...) at the beginning of the file and see if it pops up. Maybe something subtle is wrong with the path or file name.
i think the js file is not found because the after body tag nothing from the script tag in html is getting executed.....i have this js file and html file in same folder....i am providing the whole path to js file eg. c:\newfolder\abc.js
what cud be wrong? in the script tag i am using proper comment also.
Yuriy Zilbergleyt
Ranch Hand
Joined: Dec 13, 2004
Posts: 429
posted
0
..i have this js file and html file in same folder....i am providing the whole path to js file eg. c:\newfolder\abc.js
I'm not completely sure about html syntax for absolute paths, but if the html and js are in the same folder, why not just do src="abc.js" in the script element?