到底哪里出錯(cuò)了呢,反復(fù)檢測(cè)了很多遍啊,幫忙看看
<!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>使用getScript()方法異步加載并執(zhí)行js文件</title>
? ? ? ? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
? ? ? ? <link href="style.css" rel="stylesheet" type="text/css" />
? ? </head>
? ??
? ? <body>
? ? ? ? <div id="divtest">
? ? ? ? ? ? <div class="title">
? ? ? ? ? ? ? ? <span class="fl">我最喜歡的運(yùn)動(dòng)</span>?
? ? ? ? ? ? ? ? <span class="fr">
? ? ? ? ? ? ? ? ? ? <input id="btnShow" type="button" value="加載" />
? ? ? ? ? ? ? ? </span>
? ? ? ? ? ? </div>
? ? ? ? ? ? <ul></ul>
? ? ? ? </div>
? ? ? ??
? ? ? ? <script type="text/javascript">
? ? ? ? ? ? $(function () {
? ? ? ? ? ? ? ? $("#btnShow").bind("click", function () {
? ? ? ? ? ? ? ? ? ? var $this = $(this);
? ? ? ? ? ? ? ? ? ? $.getScript("http://idcbgp.cn/data/sport_f.js ",function(){
? ? ? ? ? ? ? ? ? ? ? ? $this.attr("disabled", "true");
? ? ? ? ? ? ? ? ? ? });
? ? ? ? ? ? ? ? })
? ? ? ? ? ? });
? ? ? ? </script>
? ? </body>
</html>
2016-06-08
可能是你復(fù)制那個(gè)地址的時(shí)候多復(fù)制了個(gè)空格,我也是這樣,剛剛改過(guò)來(lái)就好了
2016-05-28
我試了下你的程序,去掉.js后面的空格就可以了,你再試下。
2016-05-17
去掉了啊,還是不行,郁悶……
2016-05-16
$.getScript("http://idcbgp.cn/data/sport_f.js",function(){
? ? ? ? ? ? ? ? ? ? ? ? $this.attr("disabled", "true");
? ? ? ? ? ? ? ? ? ? })
在"http://idcbgp.cn/data/sport_f.js"? 的.js后面你多了一個(gè)空格,多一個(gè)空格都不行的