Forum Moderators: open
var randnum = Math.random();
var inum = 2;
// Change this number to the number of images you are using.
var rand1 = Math.round(randnum * (inum-1)) + 1;
images = new Array
images[1] = "images/random1.gif"
images[2] = "images/random2.gif"
// Ensure you have an array item for every image you are using.
var image = images[rand1]
In the page I have.
<script language="JavaScript">
<!-- Activate cloaking device
document.write('<td background="'+image+'">')
// Deactivate cloaking device -->
</script>
Where i want the effect to display.
Works fine when it is just a page. Soon as I save the page as a DW template it beaks.
Any ideas? I have no idea what I am doing.
Thanks in advance.
As for your problem, it seems pretty clear that Dreamweaver is messing it up. What I suggest is loading the messed-up page in a browser and then do a "View Source", and take a look at the code, and see exactly what and how Dreamweaver changed it. Once you know how it's being munged that might give you clue as to how to fix it.
Another possibility is to move the call out of the head and put it directly in the BODY, where you want the image to appear. And take out that code that draws the image and stick that in the .js file so the only thing in your document is the call to the file that draws the whole thing.