2012-02-10 121 views
0

在IE8和IE7中出现此错误。只有一点JavaScript的经验,但试图在工作中调试其他人的代码。谷歌搜索了一些原因,并使用相同的变量名称作为一些类可能会导致错误,但似乎并非如此。“对象不支持此属性或方法”javascript错误

http://pastebin.com/WBXYh9Wu

<tbody id="urlLinkTableBody"> 
<c:choose> 
    <c:when test="${!empty urlLinkUrls}"> 
     <c:forEach var="urlLinkUrl" items="${urlLinkUrls}" varStatus="status"> 
      <tr id="urlLinkRow${status.index}"> 
       <td align="left"> 
        <c:if test="${!vo.injectViewMode}"> 
         <span id="editUrl${status.index}"> 
          ${urlLinkUrl} 
         </span> 
         <input id="editUrlHidden${status.index}" type="hidden" name="urlLinkUrls" value="${urlLinkUrl}"/> 
        </c:if> 
        <c:if test="${vo.injectViewMode}"> 
         <a href="javascript:windowPop('${urlLinkUrl}')">${urlLinkUrl}</a> 
        </c:if> 
       </td> 
       <c:if test="${!vo.injectViewMode}"> 
        <script type="text/javascript"> 
         jQuery('#editUrl${status.index}').editInPlace({ 
          callback: function(original_element, newvalue, original){ 
           if (isUrl(newvalue)) { 
            document.getElementById('editUrlHidden${status.index}').value = newvalue; 
            return newvalue; 
           } 
           alert("Invalid URL"); 
           return original; 
          }, 
          show_buttons: true 
         }); 
        </script> 
       </c:if> 
+1

你已经包含了相关的jQuery插件'editInPlace'? – pimvdb 2012-02-10 10:21:38

+0

但是在哪一行你会得到错误? – 2012-02-10 10:22:15

+0

你能提供关于错误的更多信息吗? IE中报告的原始错误中是否引用了任何对象或代码行? – 2012-02-10 10:22:28

回答

0

首先,检查你已经包括了editInPlace插件脚本。

其次,这取决于插件是如何工作的,你可能需要将文件准备好处理程序中添加代码,就像这样:

<script type="text/javascript"> 
    jQuery(function() { 
     jQuery('#editUrl${status.index}').editInPlace({ 
      callback: function(original_element, newvalue, original){ 
       if (isUrl(newvalue)) { 
        document.getElementById('editUrlHidden${status.index}').value = newvalue; 
        return newvalue; 
       } 
       alert("Invalid URL"); 
       return original; 
      }, 
      show_buttons: true 
     }); 
    }); 
</script> 
+0

试过了,它做了编辑停止工作。我已经添加了一个pastebin链接到整个代码http://pastebin.com/WBXYh9Wu – sng 2012-02-10 11:08:34

相关问题