日期:2014-05-16 浏览次数:20432 次
<!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>
<title>什么事jQuery?</title>
<style type="text/css">
h5.head
{
background-color: Gray;
width: 100px;
height: 20px;
}
.content
{
visibility: hidden;
}
</style>
<!--<script type="text/javascript" language="javascript">
window.onload = function () {
alert("Hello!");
}
</script>-->
<script type="text/javascript" language="javascript" src="Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
alert("Hello!");
});
$(function () {
$("#panel h5.head").bind("click", function () {
$(this).next("div.content").show();
});
});
$(document).ready(function () {
alert("Hello2!");
});
</script>
</head>
<body>
<div id="panel">
<h5 class="head">
什么是jQuery?</h5>
<div class="content">
jQuery 是继 prototype 之后又一个优秀的 Javascript 框架。 其宗旨是—写更少的代码,做更多的事情。 它是轻量级的 js 库(压缩后只有21k),这是其它的
js 库所不及的,它兼容 CSS3,还兼容各种浏览器(IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)。 jQuery是一个快速的,简洁的
javaScript 库,使用户能更方便地处理 HTML documents、events、实现动画效果,并且方便地为网站提供AJAX交互。
</div>
</div>
</body>
</html>
.content { display: none; }
------解决方案--------------------
show() 没有参数是立即显示, 里面可以写参数,参数表示多少毫秒显示出来,有动作
------解决方案--------------------