【问题标题】:Javascript Text Insertion Not Working in Chrome?Javascript 文本插入在 Chrome 中不起作用?
【发布时间】:2010-11-28 16:01:46
【问题描述】:

大家好,这段代码在 IE 中有效,但在 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 中没有任何反应。

【问题讨论】:

    标签: html internet-explorer google-chrome


    【解决方案1】:

    您的输入没有 id 属性,您正在尝试使用 getElementById 检索它。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-02
      • 2011-04-01
      相关资源
      最近更新 更多