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>
<Body>
<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 -->
</Script>
<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">
</TABLE>
</Div>
</Body>
</Html>
I hope this article will help you design javascript programs.