Shoutbox

External javascript - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: External javascript (/showthread.php?tid=30425)

External javascript by k776 on 08-25-2004 at 09:22 AM

Ok, got one code to work, but how do you add different codes that are called by two different pages?? It gives me errors :(

Thanks for the help anyone.


RE: External javascript by Mnjul on 08-25-2004 at 10:01 AM

Well, k776, would you explain more? :)


RE: External javascript by k776 on 08-25-2004 at 10:44 AM

ok, you have javascript on page.html, you move it to jscript.js, but you also have javascript on page2.html, and want to add it to jscript.js.

I tried to do so but it gave me tons of errors (also, how do you put comment in javascript files??)


RE: External javascript by -dt- on 08-25-2004 at 10:50 AM

/* comment */


RE: External javascript by Mnjul on 08-25-2004 at 10:53 AM

Or //comment

k776,
Add this to your html file?
<script src="blahblahblah.js"></script>

For example, you have...

\1.html
\blah\2.html
\blah\3.js

In 1.html you need to use <script src="blah\3.js"></script>
And in 2.html you use <script src="2.js"></script>


RE: External javascript by k776 on 08-25-2004 at 08:56 PM

ok, I figured out what was wrong. It had nothing to do with the pages, rather the .js file. As this was my first time with these files, I read keep all code inside <!-- and --> tags

Well, the thing is, I did this:

code:
<!--
javascript code
-->
<!--
another code
-->
When it should have only been
code:
<!--
javascript code

another code
-->
Thanks for the help anyway :)
RE: External javascript by RaceProUK on 08-25-2004 at 09:52 PM

Or just

code:
javascript code

another code
HTML comments aren't needed in external JS files.