js製作的滑鼠懸浮時產生的下拉框效果

來源:互聯網
上載者:User

先給大家補補課,講個簡單的例子:
複製代碼 代碼如下:
<html><head>
<meta type-equiv="Content-Type" content="text/html">
<meta charset="utf-8″>
<script type="text/javascript">
jq=jQuery.noConflict();
jq=(document).ready(function(){
jq("a").mouseover(function(){
jq("a").css("color","#c00″);
});
jq("a').mouseout(function(){
jq("a").css("color","#000000″);
});
</script>
</head><body>
<a href="www.jb51.net">滑鼠放在上面看看會發生什麼</a>
</body></html>

jq=jQuery.noConflict();
這是定義一個js的jquery庫名;
jq(document).ready(function(){
/*這是一個關於document對象的函數裡面是函數內容*/
});
jq("a").mouseover()function(){
/*這是定義事件mouseover的內容*/
}。
在看一個實際例子;點擊時隱藏文本:
複製代碼 代碼如下:
<html><head>
<script type="text/javascript">
$(document).ready(function() {
$(".abc .hide").click(function() {
$("this").parents("abc").hide("slow"); }); });
</script>
<stype type="text/css">
div.abc {
background: #e5eec;
padding: 7px;
margin: 0px;
border: solid 1px #c00; }
</stype>
</head><body>
<div class="abc">
<p><button class="abc" type="button">hide<button><br/>
這段文字將被隱藏<br/>
這段文字也將被隱藏
</p></div>
<div class="abc"><p>
<button class="abc" type="button">hide me</button><br/>
這段文字在點擊hideme時隱藏<br/>
這段文字同樣也會隱藏。
</p></dvi>
</body></html>

功課差不多了,我們言歸正傳回到主題下拉框才是王道。
複製代碼 代碼如下:
<html><head>
<!–author linuxa
blogs: www.jb51.net–>
<meta http-equiv="content-type" content="text/html">
<meta charset="utf-8″>
<title>下拉框的製作</title>
</head><body>
</body></html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.