Image Pop-up Javascript Error
Author |
Message |
rar
|
Posted: Mon May 17, 2010 8:17 pm Post subject: Image Pop-up Javascript Error |
|
|
I am trying to use some HTML code from HyperGurl (you may or may not be familiar with it) to add an element to my page where you click on a thumbnail for a picture and it opens a small window with the full size image.
I found the code at http://www.hypergurl.com/thumbnails.html
It is as follows:
code: | <SCRIPT LANGUAGE="JavaScript">
<!-- Supplied by http://www.hypergurl.com --> function openindex() { var
OpenWindow=window.open("", "newwin","height=318,width=402");
OpenWindow.document.write("<img src='sunflower.jpg'>") OpenWindow.document.write("<br>")
OpenWindow.document.write("<center><a href='javascript:self.close()'
target='_self'>Close</a></center>") } </SCRIPT> <a
href="javascript:openindex()" target="_self"><img src='sunflower2.jpg'
border='no'></a> |
I used a debugger from IE 8 and it tells me it's missing a semi-colon. So I added one at the position they indicated, then it says missing object or something along those lines...can anyone see what's wrong with this code? It'd be extremely helpful...I know it's not the best way to learn by taking code like this from someone else's site but it's all I can do at the moment. But I'm stuck and I can't find the error in this code. Can someone help? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
Ultrahex
|
Posted: Mon May 17, 2010 8:35 pm Post subject: Re: Image Pop-up Javascript Error |
|
|
HTML: | <SCRIPT LANGUAGE="JavaScript">
function openindex() {
var OpenWindow=window.open("", "newwin","height=318,width=402");
OpenWindow.document.write(" <img src='a.jpg'>");
OpenWindow.document.write(" <br>");
OpenWindow.document.write(" <center><a href='javascript:self.close();' target='_self'>Close </a></center>");
}
</SCRIPT>
<a href="javascript:self.openindex();" target="_self"><img src='b.jpg' border='no'></a>
|
works fine for me, i would recommend putting semicolons after end of commands, if you don't then all commands must be on different lines (this may be your problem, also I'm not sure if the different lines thing is cross browser compatible). |
|
|
|
|
|
rar
|
Posted: Mon May 17, 2010 9:11 pm Post subject: Re: Image Pop-up Javascript Error |
|
|
I was able to get Lightbox working on the site.
Thanks very much for the info! |
|
|
|
|
|
|
|