Forum Moderators: open

Message Too Old, No Replies

JavaScript includes

...kind of a noob to JS...

         

Murdoch

2:00 pm on Apr 15, 2008 (gmt 0)

10+ Year Member



So I've got this script (slideshow) that operates fine when I put the entire code in the middle of my page, but I'd rather call it from outside of the page. I've tried putting it in the head and calling the function within the div I need it in:

<script type="text/javascript">function();</script>

I've tried just calling the whole thing from the div

<script type="text/javascript" src="js/function.js"></script>

Neither of those seem to work. What could I be doing wrong? I'm a bit green when it comes to the JS.

Thanks
-Doc

Murdoch

3:02 pm on Apr 15, 2008 (gmt 0)

10+ Year Member



Well I got it to work by including it in a PHP file (probably not the best way) but now it is disabling the other JavaScript function (Rounded corners) on the page.

If it isn't one thing it's another....

-Doc

Murdoch

3:45 pm on Apr 15, 2008 (gmt 0)

10+ Year Member



I got it. Thanks to previous Webmasterworld posts on the subject I learned I had to define both functions in a single window.onload statement.

Webmaterworld. Once again my saving grace.