onmouseover not working in ff

This is a discussion on "onmouseover not working in ff" within the JavaScript Forum section. This forum, and the thread "onmouseover not working in ff are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 30th, 2007, 13:35
SuperMember

SuperMember
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
onmouseover not working in ff

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
Reply With Quote

  #2 (permalink)  
Old Nov 30th, 2007, 13:39
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: onmouseover not working in ff

If it works when you remove your doctype this poses the question of what doctype you are using?

If it is an XHTML variant it is probably because you have to use special comment tags around your code

Code: Select all
<script type="text/javascript">
<!-- // --><![CDATA[
// ]]>
</script>
otherwise XHTML characters within the javascript code isn't treated as javascript, it's taken as the XHTML literals.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #3 (permalink)  
Old Nov 30th, 2007, 13:43
SuperMember

SuperMember
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: onmouseover not working in ff

Hi
Rakuli

I am using html 4.01 transitional
Reply With Quote
  #4 (permalink)  
Old Nov 30th, 2007, 13:59
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: onmouseover not working in ff

okay, FF needs you to add a unit to the length of your elements.

Code: Select all
whatcache.style.width=(parseInt(whatcache.style.width)+parseInt(whatcache.style.width)*zoomfactor*prefix) + 'px';
whatcache.style.height=(parseInt(whatcache.style.height)+parseInt(whatcache.style.height)*zoomfactor*prefix) + 'px';
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #5 (permalink)  
Old Nov 30th, 2007, 14:10
SuperMember

SuperMember
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: onmouseover not working in ff

I tried that but no joy.

I would put a link but my host is down and I cant upload the page.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
popup div onmouseover pesho318i JavaScript Forum 2 Dec 28th, 2007 13:30
onMouseOver <div> pops up next to mouse pointer - HOW? Love2Java JavaScript Forum 17 Aug 1st, 2007 19:42
onMouseOver Help Bighen JavaScript Forum 3 Jan 24th, 2006 20:17
OnMouseOver kookie09 JavaScript Forum 5 Apr 21st, 2005 23:20
OnMouseOver Action Monie JavaScript Forum 10 Dec 30th, 2004 10:19


All times are GMT. The time now is 19:37.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43