Forum Moderators: open
>width=NNN height=NNN
I have always wondered if there is a way of putting width and height attributes into the img tag before knowing what actual size they were going to be. i.e. a dymanic page looping through an array of images each with differant height values.
How does the html validator handle this?
-George
In the HEAD or External JS file:
function cPop(url, wide, high)
{window.open(url,"popup",'width=' + wide + ',height=' + high);
}
In the BODY:
<a href="javascript:cPop('page.html',300,500)">Click for enlargement</a>
Here 300 and 500 are the width and height parameters. You can put the numbers you ned for each graphic. Replace page.html with the actual name of the URL that you want to load in the popup window.
function cPop(url, wide, high) {
window.open(url,"popup",'width=' + wide + ',height=' + high);
}
</script>
<?php
$image="path/to/image.jpg"; #pointer to image
list($width, $height, $type, $attr) = getimagesize($image);
$js="cPop(\"$image\",$width,$height);";
?>
<body>
<a href="javascript:<?php echo $js;?>">image link</a>
</body>