JavaScript function to achieve the effect of the mouse pointing back with the picture

Source: Internet
Author: User

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

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.