Hi guys,

Can anyone tell me why this script no longer works in firefox? It works in the older version but since it got updated to version 3.5.3 it doesnt work anymore. It works fine in IE.

<script type="text/javascript">
function show_popup(s_file, msg, msg2, msg3, w, h)
{
var p=window.createPopup()
var pbody=p.document.body
pbody.style.backgroundColor="white"
pbody.style.border="solid white 6px"
pbody.innerHTML="<table cellpadding=0 bgcolor=white style='border:0px solid #777777'><tr><td colspan='3'><img src='images/"+s_file+"'></td></tr><tr><td align=left><font face='times' color='black' size='1'><i>"+msg+"</i></font></td><td align=left><font face='times' color='black' size='1'><i>"+msg2+"</i></font></td><td align=left><font face='times' size='1' color='black'><i>"+msg3+"</i></font></td></tr></table>"
p.show(15,15,w,h+40,document.body)
}
</script>

<!-- This is then what i add for each of the images ->>

<a href="javascript:show_popup(image.jpg','Image Example ','acrylic on masonite','62 X 48 inches',430,564)"><img src="images/thumbs/image_thumb.jpg" alt="Images" width="100" height="128" border="0" align="center" valign="TOP" /></a>

If anyone can help that would be great :)
Im a newbie so need an easy to understand explanation please.

cheers,

Shane

Recommended Answers

All 6 Replies

check if the javascript is enabled in the browser in the Tools-> options -> content -> see if the checkbox saying enable javascript, is checked.

first of all please write the correct code.... you forgot a '

show_popup('image.jpg','Image Example ','acrylic on masonite','62 X 48 inches',430,564)

second of all the functions createPopup() and show() don't exist, replace then with window.open(), for more info about that function try google
here is a code that works:

<html>
<head>
</head>
<body>

<script type="text/javascript">

function show_popup(s_file, msg, msg2, msg3, w, h)

{

var p=window.open("","mywindow", "location=1,status=1,scrollbars=1, width=100,height=100");

var pbody=p.document.body

pbody.style.backgroundColor="white"

pbody.style.border="solid white 6px"

pbody.innerHTML="<table cellpadding=0 bgcolor=white style='border:0px solid #777777'><tr><td colspan='3'><img src='images/"+s_file+"'></td></tr><tr><td align=left><font face='times' color='black' size='1'><i>"+msg+"</i></font></td><td align=left><font face='times' color='black' size='1'><i>"+msg2+"</i></font></td><td align=left><font face='times' size='1' color='black'><i>"+msg3+"</i></font></td></tr></table>"

//p.show(15,15,w,h+40,document.body)

}

</script>

<a href="javascript:show_popup('image.jpg','Image Example ','acrylic on masonite','62 X 48 inches',430,564)"><img src="images/thumbs/image_thumb.jpg" alt="Images" width="100" height="128" border="0" align="center" valign="TOP" /></a>
</body>
</html>

i don't know exactly what you want to do with that "show()" function but try checking

resizeTo(Width, height);
moveTo(x,y);

check if the javascript is enabled in the browser in the Tools-> options -> content -> see if the checkbox saying enable javascript, is checked.

It is enabled.

"First of all please write the correct code.... you forgot a '

show_popup('image.jpg','Image Example ','acrylic on masonite','62 X 48 inches',430,564)

"
Sorry i must be blind but where is it missing a '?

Thanks for sending that script but its not what i need. That script opens a pop up box. The script im trying to fix opens the images so they float over the top of the webpage without the need for a new window to open.
It was working in firefox, it still works in IE but it no longer works in the new version of firefox. Thanks for your help though.

<a href="javascript:show_popup('image.jpg'

if you want a image to hover on your page just put a div with his position:absolute and in the div put the picture... and move the div where you want it when you click the fist time then move it to -10000, -10000 for example, or make it hidden using display:
to make a nice effect make the div background partially transparent with
filter:alpha(opacity=80);-moz-opacity:0.80;opacity:.80;
if you want i can post the script i used for the same thing i've done for a site, if you want to see the effect check:
http://balaciu.ro/ and click on the picture_test link then on the picture.
hope this helps

Hi Futingkiller. I didnt see the ' was missing because i was looking in my source code not what i had written here and so its ok in the source code. I just left it out when i did it in here.

that function that you are using is IE only and there is no replacement for it... so you can't make it work in FF

Do you know why it works in the version of firefox before 3.5.3 if its not supposed to work in firefox?

I will check out that link. I liked your idea about the div tag and then moving it off the screen or hiding it. I will give that a try. Thank you! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.