Skip to content Skip to sidebar Skip to footer

Javascript Src Path

Hello I'm having some trouble with the following code within my Index.html file: This works when my Index.html f

Solution 1:

Try:

<scriptsrc="/clock.js"></script>

Note the forward slash.

Solution 2:

Use an relative path to the root of your site, for example:

If clock.js is on http://domain.com/javascript/clock.js

Include :

<scriptlanguage="JavaScript"src="/javascript/clock.js"></script>

If it's on your domain root directory:

<scriptlanguage="JavaScript"src="/clock.js"></script>

Solution 3:

The common practice is to put scripts in a discrete folder, typically at the root of the site. So, if clock.js lived here:

/js/clock.js

then you could add this code to the top of any page in your site and it would just work:

<scriptsrc="/js/clock.js"type="text/javascript"></script>

Solution 4:

Piece of cake!

<SCRIPTLANGUAGE="JavaScript"SRC="/clock.js"></SCRIPT>

Solution 5:

This works:

<scriptsrc="/clock.js"type="text/javascript"></script>

The leading slash means the root directory of your site. Strictly speaking, language="Javascript" has been deprecated by type="text/javascript".

Capitalization of tags and attributes is also widely discouraged.

Post a Comment for "Javascript Src Path"