Reprint: http://www.cnblogs.com/jack86514/archive/2009/04/01/1427584.html
When we are writing a Web application, many methods can provide the dynamic display of the page, thus improving the visual effect of the page. This example is a simple JavaScript code to dynamically display the information of the picture, in fact, there are many examples, so here only to do a simple explanation.
Now create a page with the code as follows:
<HTML> <Head> <Metahttp-equiv= "Content-type"content= "text/html; charset=gb2312" /> <title>JS function to achieve the mouse pointer to the picture with the effect of the prompt</title> <Scriptlanguage= "JavaScript"> functionShowpic (surl) {varx, y; X=Event.clientx; Y=Event.clienty; document.getElementById ("Layer1"). Style.left=x; document.getElementById ("Layer1"). Style.top=y; document.getElementById ("Layer1"). InnerHTML= "" +sURL+ "\ ">"; document.getElementById ("Layer1"). Style.display= "Block"; } functionHiddenpic () {document.getElementById ("Layer1"). InnerHTML= ""; document.getElementById ("Layer1"). Style.display= "None"; } </Script> </Head> <Body> <DivID= "Layer1"style= "display:none;position:absolute;z-index:1;"></Div> <imgsrc= "100_0899.jpg"width=50Height=50onmouseout= "hiddenpic ();"onmousemove= "Showpic (THIS.SRC);" /> <P></P> <imgsrc= "100_0909.jpg"width=50Height=50onmouseout= "hiddenpic ();"onmousemove= "Showpic (THIS.SRC);" /> </Body> </HTML>
JavaScript function to achieve the effect of the mouse pointing back with the picture