The example in this article describes the effect of a JavaScript popup box with text messages. Share to everyone for your reference, specific as follows:
Tooltips.js:
Position of the ToolTip relative to the mouse in pixel//var offsetx = 12;
var offsety = 8;
function newelement (NEWID) {if (document.createelement) {var el = document.createelement (' div ');
El.id = newid;
With (El.style) {display = ' none ';
Position = ' absolute ';
} el.innerhtml = ' ';
Document.body.appendChild (EL);
} var ie5 = (document.getelementbyidx && document.all);
var ns6 = (document.getelementbyidx &&!document.all);
var ua = Navigator.userAgent.toLowerCase ();
var isapple = (ua.indexof (' AppleWebKit ')!=-1? 1:0); function Getmouseposition (e) {if (document.getelementbyidx) {var iebody= (Document.compatmode && docum
Ent.compatmode!= ' Backcompat ')?
Document.documentElement:document.body;
Pagex = (Isapple = = 1 0: (IE5)? iebody.scrollLeft:window.pageXOffset);
Pagey = (Isapple = = 1 0: (IE5)? iebody.scrollTop:window.pageYOffset); MouseX = (IE5)? Event.x: (NS6)? clientX = e.clIentx:false;
Mousey = (IE5)? Event.y: (NS6)? clientY = E.clienty:false;
var lixlpixel_tooltip = document.getelementbyidx (' tooltip ');
Lixlpixel_tooltip.style.left = (mousex+pagex+offsetx) + ' px ';
Lixlpixel_tooltip.style.top = (mousey+pagey+offsety) + ' px ';
} function tooltip (tip) {if (!document.getelementbyidx (' tooltip ')) newelement (' tooltip ');
var lixlpixel_tooltip = document.getelementbyidx (' tooltip ');
lixlpixel_tooltip.innerhtml = tip;
Lixlpixel_tooltip.style.display = ' block ';
Document.onmousemove = getmouseposition;
function exit () {document.getelementbyidx (' tooltip '). style.display = ' None ';}
Test.html
For more information on JavaScript-related content readers can view the site topics: "JavaScript tip Box Effect Summary", "JavaScript switching effects and techniques summary", "JavaScript Search Algorithm Skills summary", " JavaScript animation effects and tips Summary, "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and Skills summary" and "JavaScript Mathematical operation Usage Summary"
I hope this article will help you with JavaScript programming.