Js implements the method of scrolling text description when hovering over an image. js hovers

Source: Internet
Author: User

Js implements the method of scrolling text description when hovering over an image. js hovers

This example describes how to scroll text instructions when Javascript is used to hover over an image. Share it with you for your reference. The specific implementation method is as follows:

Copy codeThe Code is as follows: <Title> JavaScript indicates the scroll text when hovering over an image </title>
<Script language = "JavaScript">
<! -- Begin
Function showtip2 (current, e, text ){
If (document. all & document. readyState = "complete "){
Document. all. tooltip2.innerHTML = '<marquee style = "border: 1px solid black">' + text + '</marquee>'
Document. all. tooltip2.style. pixelLeft = event. clientX + document. body. scrollLeft + 10
Document. all. tooltip2.style. pixelTop = event. clientY + document. body. scrollTop + 10
Document. all. tooltip2.style. visibility = "visible"
Else if (document. layers ){
Document.tooltip2.document.nstip.doc ument. write ('<B>' + text + '</B> ')
Document.tooltip2.document.nstip.doc ument. close ()
Document.tooltip2.doc ument. nstip. left = 0
Currentscroll = setInterval ("scrolltip ()", 100)
Document. tooltip2.left = e. pageX + 10
Document. tooltip2.top = e. pageY + 10
Document. tooltip2.visibility = "show"
Function hidetip2 (){
If (document. all)
Document. all. tooltip2.style. visibility = "hidden"
Else if (document. layers ){
ClearInterval (currentscroll)
Document. tooltip2.visibility = "hidden"
// End -->
<Div id = "tooltip2" style = "position: absolute; visibility: hidden; clip: rect (0 150 50 0); width: 150px; background-color: gold; z-index: 10 "> </div>
<Div align = "CENTER" name = "divTest" onMouseover = "showtip2 (this, event, 'Welcome to the House');" onMouseout = "hidetip2 (); "STYLE =" cursor: hand ">
<TABLE border = "0" cellpadding = "0" cellspacing = "0"> <TR> <td colspan = "7">


I hope this article will help you design javascript programs.

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.