知道为什么这在 IE 7/8 中不起作用吗?(在 IE 9 和 10、FF 和 Chrome 中运行良好)
当我单击“发送”按钮时,控制台显示:
SCRIPT438: Object doesn't support this property or method
script.1383689376.js, line 94 character 3
(Line 94) : token = $("#token").val();
HTML:
<div class="comment_heading">Leave a Comment</div>
<div class="post_comment">
<textarea name="txtpostcomment" id="txtpostcomment-'.$postid.'" class="txtpostcomment"></textarea>
<button class="btnpostcomment" id="btnpostcomment-'.$postid.'" onclick="comment('.$postid.');" type="button">Send</button>
<input type="hidden" name="token" id="token" value="'.$_SESSION['token'].'">
<script>document.getElementById("txtpostcomment-'.$postid.'").focus();</script>
</div>
脚本:
comment = function(postid1)
{
txt = $('#txtpostcomment-'+postid1);
btn = $('#btnpostcomment-'+postid1);
comment1 = $(txt).val();
token = $("#token").val();
$(btn).css('background-image', 'url(/comments/submit-busy.gif)');
$(btn).attr('disabled', true);
$(btn).attr('disabled', true);
....
....
}