jQuery中show与hide方法用法示例
本文实例分析了jQuery中show与hide方法用法。分享给大家供大家参考,具体如下:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<styletype="text/css">
*{font-size:12px;}
div{width:600px;margin:auto;}
#control{background-color:gold;padding:10px;}
</style>
<scriptsrc="../js/jquery-1.5.1.min.js"type="text/javascript"></script>
<scripttype="text/javascript">
$(function(){
$("#btnDisplay").click(function(){
$("#message").show(3000);
});
$("#btnHide").click(function(){
$("#message").hide(3000);
});
});
</script>
</head>
<body>
<divid="control">
<inputid="btnDisplay"type="button"value="显示div"/>
<inputid="btnHide"type="button"value="隐藏div"/>
</div>
<divid="message">
mouseover、mouseenter的区别:div里套div。见备注。和事件冒泡有关系。<br/>
不论鼠标指针穿过被选元素或其子元素,都会触发mouseover事件<br/>
只有在鼠标指针穿过被选元素时,才会触发mouseenter事件(穿过子元素不会触发)
</div>
</body>
</html>
更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery窗口操作技巧总结》、《jQuery拖拽特效与技巧总结》、《jQuery常用插件及用法总结》、《jquery中Ajax用法总结》、《jQuery表格(table)操作技巧汇总》、《jQuery扩展技巧总结》、《jQuery常见经典特效汇总》、《jQuery动画与特效用法总结》及《jquery选择器用法总结》
希望本文所述对大家jQuery程序设计有所帮助。