JavaScript Tooltip Code Firefox issue
Posted: 10 November 2007 02:33 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  50
Joined  2007-11-10

I have this tooltip javascript that works fine in Internet Explorer but does not execute in Firefox:

.js file contains:

tags=new Array(
    
'a',
    
'img',
    
'td'
    
);

 
bg_color='ffffff';
 
text_color='black';
 
font='arial';
 
text_size='9';
 
opacity='80';

d=document;
[removed]('<div id="floating_info" style="padding:1 3;position:absolute;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: dotted;border-right-style: solid;border-bottom-style: solid;border-left-style: dotted;border-top-color: 777777;border-right-color: 333333;border-bottom-color: 333333;    border-left-color: 777777; background:ffffff;font:bold '+text_size+'px '+font+';color:'+text_color+';display:none;width:150;z-index:2000;filter:alpha(opacity='+opacity+')"></div>')
document.onmousemove=move;
document.onmouseout="info('','off')"
function info(tip,optiune){
b
=document.getElementById('floating_info')
if (
optiune=='on'){
b
.style.display="block";
b[removed]=tip;
}
if (optiune=='off'){b.style.display="none";b[removed]=''}
}


function move(){
b
=document.getElementById('floating_info')
if(
event.clientX<d.body.clientWidth-120)
    
{b.style.left=event.x+9+d.body.scrollLeft;}
else    {b.style.left=event.x-108+d.body.scrollLeft;}

if(event.clientY>d.body.clientHeight-50)
    
{b.style.top=event.y-40+d.body.scrollTop;}
else    {b.style.top=event.y-20+d.body.scrollTop;}
}


function over(){
for(k=0;k<tags.length;k++){
 obj
=d.getElementsByTagName(tags[k])
 for(
i=0;i<obj.length;i++){
     
if(obj[i].getAttribute('info')){
    obj[i]
.onmouseover = function(){info(this.getAttribute('info'),'on')};
    
obj[i].onmouseout = function(){info('','off')};
    
}}
}
}
;

window.onload=over 

The issue might be related to the non execution of “window.onload=over” in firefox as trying window.onload=window.alert(‘Works!’);” does not return anything in firefox.

Profile
 
 
Posted: 26 December 2007 07:08 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  4
Joined  2007-12-26

Is the Javascript code within the head blocks of your page?  I’ve seen issues where if the code is placed in the wrong location, IE will handle it fine but FF will not work as expected.

Profile
 
 
Posted: 27 December 2007 11:33 AM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  50
Joined  2007-11-10

Tried placing the code both inside HEAD and BODY but it didn’t work in any of the attempts.

Profile
 
 
Posted: 16 December 2010 08:32 AM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2010-12-14
Datetopia Dating Software - 27 December 2007 11:33 AM

Tried placing the code both inside HEAD and BODY but it didn’t work in any of the attempts.

yea this will do

Profile
 
 
Posted: 16 December 2010 12:04 PM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  2
Joined  2010-12-16

Resources like the one you mentioned here is very useful! It is helpful for me.I will post a link to this page on my blog. Financial Accounting

Profile
 
 
Posted: 28 January 2011 11:24 AM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  2
Joined  2011-01-28

This is one of the good articles you can find in the net explaining everything in detail regarding the topic. I thank you for taking your time sharing your thoughts and ideas to a lot of readers out there.  FHA Loans | California DUI Lawyer

Profile
 
 
Posted: 12 March 2011 10:25 AM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  4
Joined  2011-03-05

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me.
used cars

Profile
 
 
Posted: 06 June 2011 08:21 PM   [ Ignore ]   [ # 7 ]
Sr. Member
RankRankRankRank
Total Posts:  139
Joined  2010-04-23

You could also try jQuery. It has onload events that get fired for all browsers.
_____________________________
Running - Running Log
5k - 10k - Half Marathon - Marathon

Profile