<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript">
</script>
A
<style type="text/css">
p{background-color:red;}
</style>
</head>
<body>
B
<p style="display:none;">显示出来了。</p>
<input type="button" value="show" id="show">
C
</body>
</html>D
其中三个位置A, B, C, D
<script>
$("#show").click(function () {
$("p").show("slow");
});
</script>
只放在C , D处管用。
加上
$(document).ready(function(){
之后
<script>
$(document).ready(function(){
$("#show").click(function () {
$("p").show("slow");
});
});
</script>
放在任何地方A, B, C, D 都管用。