Hi,
I am working on a script written in javascript. I want to display the text from element's
title="" tag in a div. I almots done it in IE but it doesnt work in Mozilla
Here is code:
Code:
var divname="st";
var divInnername="stp";
var fixed=true;
var soultip="<div id='st1'><div id='stp1'></div></div>"
function fm_MXY(XorY){
var coord = 0;
XorY=="x"?coord = event.clientX + document.body.scrollLeft:coord = event.clientY + document.body.scrollTop;
if(coord<0)coord=0;
return coord;
}
function fm_help(){
var d=document;
var thisObj = d.getElementById(divname);
var activeObj=window.event.srcElement;
var desc=activeObj.title;
if(desc!=null){ //If object help tag exist
var x = fm_MXY("x"), y = fm_MXY("y");
if(document.alldesc==desc){
NewCoordLeft=activeObj.offsetLeft+activeObj.offsetWidth-x;
NewCoordRight=activeObj.offsetTop-y;
}
fm_writehelp(desc);
if(fixed)document.alldesc=desc;
}else{
hy_collusionRecover();
thisObj.style.display="none";
}
}
function fm_writehelp(val){
var d=document;
var thisObj = d.getElementById(divname);
var innerObj = d.getElementById(divInnername);
innerObj.innerHTML=val;
thisObj.style.display="block";
}
if(document.all){
document.write(soultip);
document.onmousemove=fm_help;
}
and in html:
Code:
<div id="st"><div id="stp"></div></div>
<a href="http://dt" title="example text">come on touch me</a>
when you get your mouse over link, you will see the title tag's text in stp div.
So, is there anyway to make this script work on mozilla? or have you got other scripts like this?
thanks,
eren.