Forum Moderators: open

Message Too Old, No Replies

document.write not working

         

kelly5518

4:39 pm on Nov 25, 2006 (gmt 0)

10+ Year Member



I'm a real hacker with javascript so I was wondering if someone could take a look at this simple script and let me know what I'm doing wrong that's preventing the image from being displayed.

This is a popup page that displays an extra large version of an image in an e-commerce site. The correct url of the image seems to be passed because when I document.write the xlimgurl variable it displays the correct path. However, when I try to use document.write to display this image, I get a blank image as if it can't find the image.

Here's what I have:

<script language="javascript">
var loc=window.location.search;
loc=loc.substring(1,loc.length);
var xlimgurl=loc;
document.write (xlimgurl);
document.write("<br><img src='" +xlimgurl+ "'>");
</script>

<br><br>
<button name="close" style="background-color: navy; font-weight: bold; color: #FFFFFF; border: 1px solid lime" onClick="self.close()">Close</button><br><br>

I'd be really grateful for any tips.

Thanks,

kelly

kelly5518

5:24 pm on Nov 25, 2006 (gmt 0)

10+ Year Member



Never mind. I got it sorted. Needed additional parsing of the querystring to remove the variable name and the equals sign.

Thanks anyway.