Click to See Complete Forum and Search --> : javascript: problem with netscape


OhLordy
09-05-2003, 05:13 AM
Hi, when I try to run the following in netscape or mozilla I get this error


<script language="javascript">
function load_image(product_code, image, width, height)
{
window.open('image_view.php?product_code='+product_code+'?='+image,'_blank','location=no,left=200, top=200, screenX=200, screenY=200, menubar=no, resizable=no, scrollbar=no, toolbar=no, titlebar=no, width='+width+', height='+height);
}
</script>
<a href="java script:load_image('7302','product',350,450)">
<img src="http://images7.wowwoman.com/images/7/LING014_6870big.jpg" width="160" height="216" class="product" /></a>


the error


Error: load_image is not defined


Thanks in advance
Rob

Fang
09-05-2003, 05:30 AM
You have to define string variables and then put these variables into window.open

var url_name="mypage.html";
var Name="winhandle";
var Features="location=no,directories=no,etc...";
window.open(url_name, Name, Features);

Charles
09-05-2003, 05:46 AM
You're going to have problems with a lot of browsers. And you'll make a page that doesn't work at all for the 13% of users who do not use JavaScript. Instead use:

<a href="image_view.php?product_code=7302?=product" onclick="window.open(this.href, '', 'height=450,width=350,left=200,top=200,screenX=200,screenY=200'); return false">