View Full Version : Multiple Image Popups
Moonlit 08-09-2004, 09:14 AM How can I make several different popups for different images on the same page?
Code:
<script language="javascript" type="text/javascript">
//<!--
function popup()
{ window.open ("YourURLgoesHere.html","popup","width=400,height=400,location=0,menubar=0,resizabl e=0,scrollbars=0,status=0,titlebar=1,toolbar=0") }
-->
</script>
<a href="javascript:popup()"><img src="blah.gif" border=0 width="40" height="40" alt="your image description here"></a>
kittycat 08-09-2004, 06:10 PM Change the things in bold to match your info.
The things in red need to match for the same popup window, but must be different for a different popup window.
<script language="javascript" type="text/javascript">
//<!--
function popup()
{ window.open ("YourURLgoesHere.html","popup","width=400,height=400,loca tion=0,menubar=0,resizabl e=0,scrollbars=0,status=0 ,titlebar=1,toolbar=0") }
-->
</script>
<a href="javascript:popup()"><img src="blah.gif" border=0 width="40" height="40" alt="your image description here"></a>
jtchange 08-09-2004, 09:24 PM here's another idea, one function can do it all...
<script language="javascript" type="text/javascript">
//<!--
function popup(url,name,width,height)
{ window.open (url,name,"width=" + width + ",height=" + height + ",loca tion=0,menubar=0,resizabl e=0,scrollbars=0,status=0 ,titlebar=1,toolbar=0") }
-->
</script>
<a href="javascript:popup("mypage.html","windowname","400",600")"><img src="blah.gif" border=0 width="40" height="40" alt="your image description here"></a>
see the things in bold, those are the things you should take notice to, it's only one function because the variables are passed through the link, to the one function and the function uses them....hope it helped
Moonlit 08-13-2004, 09:03 AM Thanks.
Question: For multiple...do you just repeat the things in color? Or do you have to start the whole script over?
<script language="javascript" type="text/javascript">
//<!--
function popup()
{ window.open ("YourURLgoesHere.html","popup","width=400,height=400,loca tion=0,menubar=0,resizabl e=0,scrollbars=0,status=0 ,titlebar=1,toolbar=0") }
function popup()
{ window.open ("YourURLgoesHere.html","popup","width=400,height=400,loca tion=0,menubar=0,resizabl e=0,scrollbars=0,status=0 ,titlebar=1,toolbar=0") }
-->
</script>
<a href="javascript:popup()"><img src="blah.gif" border=0 width="40" height="40" alt="your image description here"></a>
lefty 08-13-2004, 03:12 PM I know this isn't my thread, but I'm asking a question anyway :P
jtchange, what's supposed to go in the url & name parts of the function, since the links are pointing to different pages?
kittycat 08-13-2004, 03:57 PM Moonlit - yes, you only repeat the things that are in colour.
Lefty - The function doesn't change, the way it's set up you only have to put url/name/size in the actual link on your page and then it will get the variables you specified from that.
|