Hi
I have never used javascript before,but i needed a script to zoom in on my images. My problem is it works fine in ie but not in ff unless i remove the doctype
as you can understand I dont want to do that.
Could you please look at the script and see if there is a solution.
javascript
- HTML: Select all
<script type="text/javascript">
var zoomfactor=0.05 //Enter factor (0.05=5%)
function zoomhelper(){
if (parseInt(whatcache.style.width)>10&&parseInt(whatcache.style.height)>10){
whatcache.style.width=parseInt(whatcache.style.width)+parseInt(whatcache.style.width)*zoomfactor*prefix
whatcache.style.height=parseInt(whatcache.style.height)+parseInt(whatcache.style.height)*zoomfactor*prefix
}
}
function zoom(originalW, originalH, what, state){
if (!document.all&&!document.getElementById)
return
whatcache=eval("document.images."+what)
prefix=(state=="in")? 1 : -1
if (whatcache.style.width==""||state=="restore"){
whatcache.style.width=originalW
whatcache.style.height=originalH
if (state=="restore")
return
}
else{
zoomhelper()
}
beginzoom=setInterval("zoomhelper()",100)
}
function clearzoom(){
if (window.beginzoom)
clearInterval(beginzoom)
}
</script>
HTML
- HTML: Select all
<a href="#" onMouseOver="zoom(150,150,'logo','in')" onMouseOut="clearzoom()">Zoom In</a> | <a href="#" onMouseOver="zoom(150,150,'logo','restore')">Normal</a> | <br /><br /><br />
<div style="margin-left:50px;width:150;height:150" align="center">
<img src="<?php echo $item_image; ?>" id="logo" /><?php echo $display_block; ?>
</div>
Thanks in advance
Pat