Improved simple ToolTips display

Source: Internet
Author: User
By using JS, the display effect of tooltips is improved, and CSS can be further used to beautify the improved tooltips. Front-end layout code:
 <asp:Panel ID="Panel1" runat="server" Height="460px" ScrollBars="Auto"         Width="735px">     <div id="info" runat="server" style=" line-height:35px;     padding:10px 0 0 10px;" ></div>    </asp:Panel>          <div id="show" style="         border: thin dashed #808080;          z-index: 1; position: absolute;         top: 300px; left:120px; line-height:35px;          width: 450px; padding:15px 15px 15px 15px;          background-color :#FFFF99; visibility:hidden; "></div>

Front-end JS script:

function cl() {            var n = document.getElementById("mid");            var s = document.getElementById("show");            s.innerText = n.title;            var v = new Array();            v = document.getElementsByClassName("sign");            for (i = 0; i < v.length; i++)                v[i].style.color = "Blue";            n.style.color = "LimeGreen";            for (i = 0; i < v.length; i++)                v[i].id = "";            s.style.top = window.event.clientY + "px";            //s.style.left=(window.event.clientX + 50 )+ "px";            s.style.visibility = "visible";
}

Background code:

String STR = ""; datatable dt = new datatable (); // assign values to data tables... three columns: tooltips content column link pointing to address column link display text column for (I = 0; I <DT. rows. count; I ++) {STR + = "<a Title = '" + dt. rows [I] ["tooltips content column"]. tostring () + "'target = '_ blank' href = '#" + dt. rows [I] ["link to address column"]. tostring () + "'class = 'sign' onmouseover = \" this. id = 'mid '; CL () \ ">" + dt. rows [I] ["link display text column"]. tostring () + "</a> <br/>";} info. innerhtml = STR + "<br/>"; DT. dispose ();

Final effect:

  

 

Improved simple ToolTips display

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.