1) Script: Ultimate Fade-In Slideshow (v1.5)
2) http://www.dynamicdrive.com/dynamici...nslideshow.htm
3) Problem:
Hello all,
I am trying to save the <HEAD> script in an external js file (fadeimages.js) which is in the same directory as all my other HTML pages, and I have an images folder off that directory. As far as I know the js file has the correct path to the images. The slideshow works perfectly when everything is left in the one HTML but I am battling when using an external js.
I have had a good look around for an hour or two, and have worked through jscheuer's suggestions here: http://www.dynamicdrive.com/forums/s...ad.php?t=10065 as well as several others elsewhere. I have no <!-- or --> hiding tags in the external file and am confident my paths are all sweet.
Initially I had the "'fadeshow' is undefined" error, which disappeared after I put " src="fadeimages.js" " with the script call in the BODY where the fadeshow() function is called. Well enough chit chat, here is some code:
External fadeimages.js
BODY of index.html in questionCode:<script language="javascript" type="text/javascript"> var fadeimages=new Array() //SET IMAGE PATHS. Extend or contract array as needed fadeimages[0]=["images/night1.jpg", "", ""] fadeimages[1]=["images/night2.jpg", "", ""] //plain image syntax fadeimages[2]=["images/dining.jpg", "", ""] fadeimages[3]=["images/dining2.jpg", "", ""] fadeimages[4]=["images/living.jpg", "", ""] fadeimages[5]=["images/bedroom.jpg", "", ""] fadeimages[6]=["images/day1.jpg", "", ""] var fadebgcolor="white" //// nothing edited beyond here, honest ///////////// ... </script>
I wasn't sure if the credit lines were needed to actually get the thing to run, so have put them in a couple of spots. When I run thet page in IE everything looks fine... but no slideshow gets displayed. Also, currently I get a little "Syntax error" on Line 2, character 1 of my HTML page. Here is the HEAD of my index.html page (give or take):Code:<td width="600" height="240" valign="top"> <script src="fadeimages.js" type="text/javascript"> /*********************************************** * Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ //new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay) new fadeshow(fadeimages, 600, 240, 0, 3000, 0, "R") </script> </td>
HEAD of index.html
Many thanks, and I look forward to responses from anyone who has a little time to assist. I am all ears (and a lot of nose unfortunately).Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="a collection of words that will hopefully give my site props with Google" /> <meta http-equiv="imagetoolbar" content="no"> <title>My Website</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> <script language="javascript" src="fadeimages.js" type="text/javascript"> /*********************************************** * Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ </script> <!--This is a little script to disable right-clicking on images and a message pops up --> <script language="javascript" type="text/javascript"> <!-- var message="Please contact us for images."; function click(e) { if (document.all) { if (event.button==2||event.button==3) { alert(message); return false; } } if (document.layers) { if (e.which == 3) { alert(message); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; // --> </script> <!-- some style code that DW8 put in when I made my footer text smaller than the rest of the page as described in stylesheet.css --> <style type="text/css"> <!-- .style5 {font-size: 9px} --> </style> </head>
Kind regards,
Snax



:
Reply With Quote
I now have that locked in for the future. Thinking about it now, it makes perfect sense with the script tag and "src" declared in the head of the html page already.


Bookmarks