這個代碼爲什麼此代碼與jquery 1.3.2協同工作,但與1.4.2協同工作?
var tip = "<p class='adobe-reader-download'>Most computers will open PDF documents automatically, but you may need to download <a title='Link to Adobe website-opens in a new window'";
tip +=" href='http://www.adobe.com/products/acrobat/readstep2.html' target='_blank'>Adobe Reader</a>.</p>";
if($("div#maincontent a[href*='.pdf']").length>0){
$("div#maincontent").children(":last-child").after(tip);
正常工作與此
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"
type="text/javascript"></script>
但與此
<script
type="text/jscript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>
對於一個你沒有逃過'adobe-reader-download'周圍的雙引號的人。 – cletus 2010-04-24 13:42:03
我不知道爲什麼。但也許是因爲你的如果沒有關閉.. PS:你可以擺脫「> 0」它沒有它的工作原理:P – meo 2010-04-24 13:43:22
你真的沒有解釋太多什麼是行不通的。你有沒有試過用Firebug來看看發生了什麼? DOM是否會被修改?有錯誤嗎? – Pointy 2010-04-24 14:37:07