2009-09-16 76 views
1

嘿傢伙,這一點的代碼工作在IE瀏覽器,但沒有在Chrome,任何想法爲什麼?Javascript文本插入不適用於Chrome?

<script type="text/javascript"> 
    function fillreply(commentID){ 
     var item = document.getElementById("replyto"); 
     item.value=commentID; 
    } 
    </script> 
... 

... 
    <div id="makereply" class="hidden">Reply to: <input type="text" size="6" 
     name="replyto" readonly /> 

在IE javascript:fillreply(4);工作,但無法在Chrome那裏什麼也沒有發生。

回答

2

您的輸入沒有id屬性,而您嘗試使用getElementById檢索它。

<input type="text" size="6" id="replyto" name="replyto" readonly="readonly" /> 
+0

doh!謝謝(15個字符) – 2009-09-16 02:27:48

相關問題