Document.write help, please!
I want to have an image gallery that displays the thumbnails based on a for loop, as opposed to me having to write each image tag.
This is what I'm trying to do (code-wise):
It is initalized in the body tag:
How come it reloads the page, prints out the result on a blank page,and then reloads the original page the code was called from, with nochanges on it, whenever it's initialized?
The code actually sits in the correct area where I want the images to appear. Why isn't it working?
The page is at: http://melissamunroe.com/1/index.php?option=com_content&task=view&id=80&Itemid=69 (the images aren't uploaded yet; that's fine, I just want to the code to work - there's a border around each image so it should display that at least).
This is what I'm trying to do (code-wise):
<script language="JavaScript">
<!--
function txt() {
caption = "fashion" + x;
document.getElementById("paragraph").inn erHTML = caption;
}
function thumbs() {
initialize();
for (var x = 1; x <= 35; x ++) {
thumb = "http://www.melissamunroe.com/1/images/photography/fashion/thumbs/" + x + ".jpg";
image = "http://www.melissamunroe.com/1/images/photography/fashion/" + x + ".jpg";
document.write("<img src=" + thumb + " border="1">");
}
}
-->
</script>It is initalized in the body tag:
<body onLoad="javascript:thumbs();">How come it reloads the page, prints out the result on a blank page,and then reloads the original page the code was called from, with nochanges on it, whenever it's initialized?
The code actually sits in the correct area where I want the images to appear. Why isn't it working?
The page is at: http://melissamunroe.com/1/index.php?option=com_content&task=view&id=80&Itemid=69 (the images aren't uploaded yet; that's fine, I just want to the code to work - there's a border around each image so it should display that at least).
