本文實例講述了js實現鼠標移到鏈接文字彈出一個提示層的方法。分享給大家供大家參考。具體分析如下:
這里實現鼠標移動到鏈接文字上面,彈出一個已定義好的DIV層的效果。在這個層里你可以加入與此鏈接對應的信息,這樣就成了一個信息提示窗,在淘寶、新浪都能看到這種效果,很實用。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>鼠標移到文字上彈出提示層</title><style type="text/css"><!--#box{display:none;width: 315px;height: 180px; background:#CCC;border:1px solid #333;padding:12px;text-align:center;}--></style><script type="text/javascript" language="javascript" ><!--function display(){document.getElementById("box").style.display="block"; }function disappear(){document.getElementById("box").style.display="none"; }--></script></head><body><a href="#" onmouseover="display()" onmouseout="disappear()">鼠標放到這兒!</a><div id="box" onmouseover="display()" onmouseout="disappear()">效果不錯吧?這里面你可以設置一張圖片,也可以是一段文字,而且源代碼很簡單哦!</div></body></html>希望本文所述對大家的javascript程序設計有所幫助。
新聞熱點
疑難解答