Home >Web Front-end >JS Tutorial >JavaScript implements simple Tip prompt box effect_javascript skills
The example in this article describes how to implement a simple Tip box effect using JavaScript. Share it with everyone for your reference, the details are as follows:
// JavaScript Document document.write("<div id='tip' style='position:absolute; width:300px; z-index:1; background-color: #ffffff; border: 1px solid gray; overflow: visible;visibility: hidden;font-size:12px;padding:12px;color:#333333'></div>") function showtip(w){ var x=event.x; var y=event.y; tip.innerHTML=w; tip.style.visibility="visible"; tip.style.left=x+10; tip.style.pixelTop=y+document.body.scrollTop+10; } function hidetip(){ tip.style.innerHTML="" tip.style.visibility="hidden"; }
Save the above as: showtip.js
<table width="100%" border="0" cellspacing="0" cellpadding="0" background="#F7F7F0"> <tr height="25"> <td background="images/line-dot.gif" height="20" align="left"><IMG height="5" src="images/dot2.gif" width="5"> <a onmousemove="showtip('<b>标题:</b><br>毕业女生 自信更在包装外<br>')" onmouseout=hidetip() href='Common/NewsDetails.aspx?id=1035' target=_blank> 毕业女生 自信更在包装外 </a> </td> </tr> <tr> <td background="images/point_h.gif" height="1"></td> </tr> </table>
Readers who are interested in more JavaScript-related content can check out the special topics on this site: "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm techniques", "Summary of JavaScript animation special effects and techniques", "Summary of JavaScript errors and debugging skills", "Summary of JavaScript data structures and algorithm techniques", "JavaScript traversal Summary of Algorithms and Techniques" and "Summary of JavaScript Mathematical Operation Usage"
I hope this article will be helpful to everyone in JavaScript programming.