View Full Version : How do I make a mouse over that pops up a window?


nsyncie
07-16-2003, 09:10 AM
I want to make a mouse-over enter picture so when you click it, it opens a pop-up window...can someone help me please?

kittycat
07-16-2003, 04:20 PM
http://www.lissaexplains.com/javascript4.shtml#window

The second code on the page.

nsyncie
07-16-2003, 07:27 PM
Pop-up code:

<script language="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>


How would I add this mouse over effect to it?

<script language="JavaScript">
<!-- Hide the script from old browsers --

img0_on = new Image(width,height);
img0_on.src="image2.gif";
img0_off = new Image(width,height);
img0_off.src="image1.gif";

img1_on = new Image(width,height);
img1_on.src="image4.gif";
img1_off = new Image(width,height);
img1_off.src="image3.gif";

img2_on = new Image(width,height);
img2_on.src="image6.gif";
img2_off = new Image(width,height);
img2_off.src="image5.gif";

img3_on = new Image(width,height);
img3_on.src="image8.gif";
img3_off = new Image(width,height);
img3_off.src="image7.gif";

function over_image(parm_name)
{
document[parm_name].src = eval(parm_name + "_on.src");
}
function off_image(parm_name)
{
document[parm_name].src = eval(parm_name + "_off.src");
}
// --End Hiding Here -->
</script>

<a href="yoururl.html" onmouseover="over_image('img0');" onmouseout="off_image('img0')"> <img src="image1.gif" border="0" name="img0"> </a>

kittycat
07-16-2003, 08:41 PM
Have both the javascript codes in the head section, and have your link look like <a href="javascript:popup();" onmouseover="over_image('img0');" onmouseout="off_image('img0')"> <img src="image1.gif" border="0" name="img0"> </a>. I think it'll work

nsyncie
07-16-2003, 11:15 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<script language="javascript">
//<!--
function popup()
{ window.open ("http://www.geocities.com/urhottwhenimdrunk/index.htm","popup"," width=777,height=555,loca
tion=0,menubar=0,resizabl
e=0,scrollbars=0,status=0
,titlebar=1,toolbar=0") }
-->
</script>

<script language="JavaScript">
<!-- Hide the script from old browsers --

img0_on = new Image(480,327);
img0_on.src="http://www.geocities.com/urhottwhenimdrunk/enter2.jpg";
img0_off = new Image(480,327);
img0_off.src="http://www.geocities.com/urhottwhenimdrunk/enter1.jpg";


img1_on = new Image(width,height);
img1_on.src="image4.gif";
img1_off = new Image(width,height);
img1_off.src="image3.gif";

img2_on = new Image(width,height);
img2_on.src="image6.gif";
img2_off = new Image(width,height);
img2_off.src="image5.gif";

img3_on = new Image(width,height);
img3_on.src="image8.gif";
img3_off = new Image(width,height);
img3_off.src="image7.gif";

function over_image(parm_name)
{
document[parm_name].src = eval(parm_name + "_on.src");
}
function off_image(parm_name)
{
document[parm_name].src = eval(parm_name + "_off.src");
}
// --End Hiding Here -->
</script>

</head>

<body>

<a href="javascript:popup();" onmouseover="over_image('img0');" onmouseout="off_image('img0')"> <img src="http://www.geocities.com/urhottwhenimdrunk/enter1.jpg" border="0" name="img0"> </a>

</body>
</html>

Still doesnt work for me...heres the link if you want to see it

http://www.geocities.com/urhottwhenimdrunk/test.html

When you click it, its suppose to open a 777, 555 pop-up window...but its not working still

nsyncie
07-17-2003, 12:04 AM
Nevermind...I fixed it...instead I used a chromless window. Thanks for all your help!! I love this message board!