View Full Version : Image Pop-Up Code..need help


Shortie2x4
11-17-2005, 07:17 PM
I am using this 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>

I am trying to make a photo album and use the pop ups. Problem: If i put more than 1 of the code provided above, the thumbnails themself show the actual photo, but when you click on the thumbnail, the last photo in the Header is the one that shows up when you click on all the thumbnails. Is there something else I should be doing??

Douglas
11-19-2005, 01:06 AM
bleh i dont understand your problem.. what exactly do you do and what happens? here is some fixes to your 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>


you forgot the ; at the end of the code, and the // in front of the <!-- doesnt work right like that ;)

hobokenjam
11-19-2005, 08:25 PM
You want to create a reusable script that you can call from several links. To do this, you have to use a variable to tell the script which page to display in the popup window...

<html>
<head>
<title>Example Script</title>
<script type="text/javascript" language="javascript">
function popup(pageName)
{ window.open (pageName+".html","popup","width=400,height=400,location=0,menubar=0,resizabl e=0,scrollbars=0,status=0,titlebar=1,toolbar=0") }

</script>
</head>

<body>
<p>Click <a href="javascript:popup('test')">here</a> to launch a popup for test.html</p>
<p>Click <a href="javascript:popup('test2')">here</a> to launch a popup for test2.html</p>
<p>Click <a href="javascript:popup('test3')">here</a> to launch a popup for test3.html</p>

</body>
</html>

windowshopper
11-19-2005, 08:33 PM
The easiest thing to do is to go to javascriptkit.com. They should have that script there for you. Plus, they actually explain it and show you how to use it. You can also alter the settings in a pop up window. You can also try dynamic drive.com Hope that helps.