Forum Moderators: open

Message Too Old, No Replies

placing js in external file

         

salamano

9:01 am on Mar 29, 2006 (gmt 0)

10+ Year Member



Hi -
I am using a javascript slideshow script which I got from a popular scripts resource site. It follows the usual drill of placing code in head of page, then placing trigger for the slideshow in the appropriate place in the page body. In this case my trigger code looks like this:

[code]<div id="imageblock"><script type="text/javascript">new fadeshow(slideshow, 344, 228, 0, 4000, 1)</script></div> [code]

Can anyone tell me how to place the lengthy code currently in head into an external file instead? I tried making a file "slideshow.js" and using the following to call it in:

[code]<div id="imageblock"><script type="text/javascript" src="slideshow.js">new fadeshow(slideshow, 344, 228, 0, 4000, 1)</script></div>[code]

but with no luck . . .

Can anyone help?

rescendent

9:36 am on Mar 29, 2006 (gmt 0)

10+ Year Member



You might want to try:


<div id="imageblock">
<script type="text/javascript" src="slideshow.js"></script>
<script type="text/javascript">
new fadeshow(slideshow, 344, 228, 0, 4000, 1);
</script>
</div>

A script block can either be an exteral file reference or inline code, but both won't work. So in your example you need two script blocks as above...

HTH

salamano

11:36 am on Mar 29, 2006 (gmt 0)

10+ Year Member



Thank you - works a treat :))