JavaScript popup with text message box effect _javascript tip

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.