再jsp页面中引入prototype.js,页面就会出现JS错误“对象不支持此属性或方法” 有没有遇到过这种错误

解决方案 »

  1.   

    应该可能性不大 firefox下一点问题都没有 只有ie出错,还有要是引用路径出错不能使用ajax,使用还是正常<%@ include file="/includes/taglibs.jsp"%>
    <%@ page contentType="text/html;charset=UTF-8"%>
    <script src="${ctx}/scripts/prototype.js"></script>
    <script type="text/javascript">
    function setValue(){
    var active = document.getElementById('isFaq');
    if (active.checked==true){
    active.value='true';
    }else{
    active.value='false';
    }
    }
    function validateNumber(){      
    var url="${ctx}/attendant/KbsEntry/checkNumberExists.do?number="+document.getElementById('number').value;
    var request=new Ajax.Request(url,{method:"get",onComplete:doValidate});
    }
    function doValidate(request){
           var text=request.responseText;
                if(text=="true"){
    if(confirm('你输入的编号已存在')){
    document.getElementById('number').value="";
    document.all.number.focus();
    }
             }
    }
    </script> <tr>
    <td height="30"  width="20%"><strong><font color="#FF0000"></font>&nbsp;<fmt:message key="entry.isFaq"/>:</strong>
    <c:choose>
      <c:when test="${isfaq=='true'}">
    <input type="checkbox" id="isFaq" name="isFaq"  checked onclick="setValue()";>
      </c:when>
              <c:otherwise>
            <input type="checkbox" id="isFaq" name="isFaq"  onclick="setValue()";>
      </c:otherwise>
        </c:choose>
        </td>
     </tr>
     <tr>
    <td height="30" valign="bottom" align="left"><strong><font color="#FF0000">*</font>&nbsp;<fmt:message key="entry.number"/>:</strong></td>

     </tr>
     <tr>
     <!-- <td width="100%" align="left"><input name="number" type="text" id="number" class="text medium required validate-length-range-3-20 validate-ajax"   validateUrl="${ctx}/attendant/KbsEntry/checkNumberExists.do"  validateFailedMessage="编号已经存在" style="width: 100%"></td> -->
      <td width="100%" align="left"><input name="number" type="text" id="number"   onchange="validateNumber()"  style="width:100%"></td> 
    </tr>
    <tr>
    <td height="30" valign="bottom" align="left"><strong><font color="#FF0000">*</font>&nbsp;<fmt:message key="entry.subject"/>:</strong></td>

    </tr>
    <tr>
    <td width="100%" align="left"><input name="subject" type="text" id="subject" class="required max-length-200" style="width: 100%"></td>
    </tr>
    <tr>
    <td height="30" valign="bottom" align="left"><strong><font color="#FF0000">*</font>&nbsp;<fmt:message key="entry.sort"/>:</strong></td>

    </tr>
    <tr>
    <td width="100%" align="left">
    <select name="kbsSortId" id="kbsSortId" size="8" class="required" style="width: 100%;">
    <c:forEach items="${kbsSortsList}" var="sort">
    <c:choose>
    <c:when test="${kbsSort != null && kbsSort.id == sort.id}"><option value="${sort.id}" selected>${sort.name}</option></c:when>
    <c:otherwise><option value="${sort.id}">${sort.name}</option></c:otherwise>
    </c:choose>
    </c:forEach>
    </select>
    </td>
    </tr>
    <tr>
    <td height="30" valign="bottom"><strong><font color="#ff0000">*</font>&nbsp;<fmt:message key="entry.content"/>:</strong></td>

    </tr>
    <tr>
    <td width="100%" align="left">
    <textarea name="content" id="content" rows="20" style="width: 100%"></textarea>
    </td>
    </tr>