新手 jQuery 问题

小哥、 2012-03-27 11:11:46
<!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></title>
<script src="../JS/jquery-1.4.4.min.js" type="text/javascript">
$("#Button1").bind("click", function (event) { $("#ss").show(); });
$("#Button2").bind("click", function (event) { $("#ss").hide(); });
</script>
</head>
<body>
<div id="ss">Hello World</div>
<input id="Button2" type="button" value="隐藏" />
<input id="Button1" type="button" value="显示" />

</body>
</html>


为什么没作用
...全文
134 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
freedom_gooboy 2012-03-27
  • 打赏
  • 举报
回复

<script src="../JS/jquery-1.4.4.min.js" type="text/javascript"></script> //引用js文件,这是规定的写法



<script type="text/javascript">
.......
</script>//在当前页面写的js,要用这样的定义
小哥、 2012-03-27
  • 打赏
  • 举报
回复
为什么不可以在引用里面的写啊[Quote=引用 8 楼 x605940745 的回复:]

啥意思 不懂 ??? 引用 2 楼 zsx841021 的回复:

大哥引用的js文件是js文件。。自己写诗自己写的。。不要混为一谈。。。HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.……
[/Quote]
还在加载中灬 2012-03-27
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 x605940745 的回复:]

啥意思 不懂 ??? 引用 2 楼 zsx841021 的回复:

大哥引用的js文件是js文件。。自己写诗自己写的。。不要混为一谈。。。HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.……
[/Quote]
就是下面的效果

<script src="../JS/jquery-1.4.4.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$("#Button1").bind("click", function (event) { $("#ss").show(); });
$("#Button2").bind("click", function (event) { $("#ss").hide(); });
});
</script>
小哥、 2012-03-27
  • 打赏
  • 举报
回复
啥意思 不懂 ??? [Quote=引用 2 楼 zsx841021 的回复:]

大哥引用的js文件是js文件。。自己写诗自己写的。。不要混为一谈。。。HTML code
<!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/……
[/Quote]
Acesidonu 2012-03-27
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 zsx841021 的回复:]

引用 2 楼 zsx841021 的回复:

大哥引用的js文件是js文件。。自己写诗自己写的。。不要混为一谈。。。HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html……
[/Quote]
++
不熟不聊 2012-03-27
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 zsx841021 的回复:]

引用 2 楼 zsx841021 的回复:

大哥引用的js文件是js文件。。自己写诗自己写的。。不要混为一谈。。。HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html……
[/Quote]
+1
001007009 2012-03-27
  • 打赏
  • 举报
回复
没看仔细,综合 1、2 楼
三石-gary 2012-03-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 zsx841021 的回复:]

大哥引用的js文件是js文件。。自己写诗自己写的。。不要混为一谈。。。HTML code
<!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/……
[/Quote]

<!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></title>
<script src="../JS/jquery-1.4.4.min.js" type="text/javascript"></script>
<script>
$(function(){
$("#Button1").bind("click", function (event) { $("#ss").show(); });
$("#Button2").bind("click", function (event) { $("#ss").hide(); });
});
</script>
</head>
<body>
<div id="ss">Hello World</div>
<input id="Button2" type="button" value="隐藏" />
<input id="Button1" type="button" value="显示" />

</body>
</html>
还在加载中灬 2012-03-27
  • 打赏
  • 举报
回复
$(document).ready(function(){
$("#Button1").bind("click", function (event) { $("#ss").show(); });
$("#Button2").bind("click", function (event) { $("#ss").hide(); });
})
换这样试试
三石-gary 2012-03-27
  • 打赏
  • 举报
回复
大哥引用的js文件是js文件。。自己写诗自己写的。。不要混为一谈。。。
<!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></title>
<script src="../JS/jquery-1.4.4.min.js" type="text/javascript"></script>
<script>
$("#Button1").bind("click", function (event) { $("#ss").show(); });
$("#Button2").bind("click", function (event) { $("#ss").hide(); });
</script>
</head>
<body>
<div id="ss">Hello World</div>
<input id="Button2" type="button" value="隐藏" />
<input id="Button1" type="button" value="显示" />

</body>
</html>
001007009 2012-03-27
  • 打赏
  • 举报
回复
<!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></title>
<script src="../JS/jquery-1.4.4.min.js" type="text/javascript">
$(function(){
$("#Button1").bind("click", function (event) { $("#ss").show(); });
$("#Button2").bind("click", function (event) { $("#ss").hide(); });
})
</script>
</head>
<body>
<div id="ss">Hello World</div>
<input id="Button2" type="button" value="隐藏" />
<input id="Button1" type="button" value="显示" />

</body>
</html>


注意 顺序, dom还没加载

87,989

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧