在http://code.google.com/p/jqueryjs/downloads/list 下载了jquery-1.3.2.js,更名为jquery.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>Hello, jQuery World!</title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
</head><body>
<div id="divMsg">Hello World!</div>
<input id="btnShow" type="button" value="显示" />
<input id="btnHide" type="button" value="隐藏" /><br />
<input id="btnChange" type="button" value="修改内容为 Hello World, too!" />
<script type="text/javascript" >
("#btnShow").bind("click", function(event) { ("#divMsg").show(); });
("#btnHide").bind("click", function(event) { ("#divMsg").hide(); });
("#btnChange").bind("click", function(event) { ("#divMsg").html("Hello World, too!"); });      
</script>
</body>
</html>以上代码存储为1.html,与jquery.js在同一个目录里。运行了一下,出现了错误。怎么回事?是不是缺点什么?

解决方案 »

  1.   

    <!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>Hello, jQuery World!</title>
    <meta name="generator" content="editplus" />
    <meta name="author" content="" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
    </head><body>
    <div id="divMsg">Hello World!</div>
    <input id="btnShow" type="button" value=">f示" />
    <input id="btnHide" type="button" value="趨藏" /><br />
    <input id="btnChange" type="button" value="修改内容:N Hello World, too!" />
    <script type="text/javascript" >
            $("#btnShow").bind("click", function(event) { $("#divMsg").show(); });
            $("#btnHide").bind("click", function(event) { $("#divMsg").hide(); });
            $("#btnChange").bind("click", function(event) { $("#divMsg").html("Hello World, too!"); });      
    </script>
    </body>
    </html>