要实现的功能需要在ajax输出的页面结构中再次使用ajax输出新的内容,如果把所有ajax输出区域放在静态页面,可以实现;但是,改成在动态页面区域中再重新定义动态区域输出时,IE就报出“[b][color=red]未知的运行时错误[/color][/b]”,查找相关资料,做的尝试如下:
1.检查尝试加到innerHTML的html代码是否包含破损的html标签,没有发现此类错误;
2.把容器改成那些比较“包容”的标签,已将容器改成div和span;
3.将容器标签放在form外面,已做修改;
试过各种方式,还是未果,希望有遇此问题的高手指点一下吧。
[b][color=olive]相关代码如下:[/color][/b]
[color=olive]base.js页面相关代码[/color]
var MyAjax = {
.......
getDataAndDisplay : function(url, spanId,formName) {
.......
var text = xmlHttp.responseText.split("<body>");
var result = text[1].replace("</body></html>", "");
[b][color=red] document.getElementById(spanId).innerHTML = result;[/color][/b]} [color=blue] //出问题的地方[/color]
.......
}
......
}
[color=olive]ajax.jsp页面相关代码:[/color]
<c:if test="${not empty requestScope.peakValleyPath}">
<div style="align:center;width:90%">
<c:if test="${fn:length(requestScope.peakValleyPath)>1}">
<div style="float:left;width:50%;">
<img src="../../${requestScope.peakValleyPath }"/>
</div>
<div style="float:right;width:50%;">
<c:if test="${not empty requestScope.peakValleyTable }">
[b][color=darkred]<button οnclick="calculatePeakValleyValue('${requestScope.analysisIndicatorNumber }');">峰谷分析</button><[/color][/b]br>// [color=blue]第二次使用ajax[/color]
<span>${requestScope.peakValleyTable }</span><br>
[b][color=darkred]<span id="pvAnalysisResult"></span><br><span id="peakValleySaveInfo"></span>[/color][/b] </c:if>] [color=blue]//第二次使用ajax结果输出位置[/color]
<c:if test="${empty requestScope.peakValleyTable }"><center><span style="color:red"><h2>不好意思,不存在峰谷</h2></span></center></c:if>
</div>
</c:if>
<c:if test="${requestScope.peakValleyPath=='1' }"><center><span style="color:red"><h2>数据长度不够</h2></span></center></c:if>
<c:if test="${requestScope.peakValleyPath=='2' }"><center><span style="color:red"><h2>数据不完整</h2></span></center></c:if>
<c:if test="${requestScope.peakValleyPath=='3' }"><center><span style="color:red"><h2>没有数据,无法生成图片</h2></span></center></c:if>
</div>
</c:if>
[color=blue]//第二次使用ajax输出结果的代码[/color]
<c:if test="${not empty requestScope.peakValleyOrderResultList }">
<div>
<table class="table1" cellspacing="0" cellpadding="8" width="" align="center">
<tr><td class="td3" width="150px" align="center"><div align="center">峰谷分析结果:</div></td>
<c:forEach var="peakValleyOrderResult" items="${requestScope.peakValleyOrderResultList }">
<td class="td3" width="150px">峰平均阶数为${peakValleyOrderResult.peakOrder },标准差为${peakValleyOrderResult.peakStdev };谷平均阶数为${peakValleyOrderResult.valleyOrder },标准差为${peakValleyOrderResult.valleyStdev }
<input type="hidden" name="peakValleyResult" value="峰平均阶数为${peakValleyOrderResult.peakOrder },标准差为${peakValleyOrderResult.peakStdev };谷平均阶数为${peakValleyOrderResult.valleyOrder },标准差为${peakValleyOrderResult.valleyStdev }"/>
</td>
</c:forEach>
</tr>
<tr><td colspan="2" align="center">
<div><button class="ManagerButton" type="button" onClick="javascript:dealWithIndicatorValue('savePeakValleyResultToDB','${param.frequency}');">保存分析结果</button></div>
</td></tr>
</table>
</div>
</c:if>
1.检查尝试加到innerHTML的html代码是否包含破损的html标签,没有发现此类错误;
2.把容器改成那些比较“包容”的标签,已将容器改成div和span;
3.将容器标签放在form外面,已做修改;
试过各种方式,还是未果,希望有遇此问题的高手指点一下吧。
[b][color=olive]相关代码如下:[/color][/b]
[color=olive]base.js页面相关代码[/color]
var MyAjax = {
.......
getDataAndDisplay : function(url, spanId,formName) {
.......
var text = xmlHttp.responseText.split("<body>");
var result = text[1].replace("</body></html>", "");
[b][color=red] document.getElementById(spanId).innerHTML = result;[/color][/b]} [color=blue] //出问题的地方[/color]
.......
}
......
}
[color=olive]ajax.jsp页面相关代码:[/color]
<c:if test="${not empty requestScope.peakValleyPath}">
<div style="align:center;width:90%">
<c:if test="${fn:length(requestScope.peakValleyPath)>1}">
<div style="float:left;width:50%;">
<img src="../../${requestScope.peakValleyPath }"/>
</div>
<div style="float:right;width:50%;">
<c:if test="${not empty requestScope.peakValleyTable }">
[b][color=darkred]<button οnclick="calculatePeakValleyValue('${requestScope.analysisIndicatorNumber }');">峰谷分析</button><[/color][/b]br>// [color=blue]第二次使用ajax[/color]
<span>${requestScope.peakValleyTable }</span><br>
[b][color=darkred]<span id="pvAnalysisResult"></span><br><span id="peakValleySaveInfo"></span>[/color][/b] </c:if>] [color=blue]//第二次使用ajax结果输出位置[/color]
<c:if test="${empty requestScope.peakValleyTable }"><center><span style="color:red"><h2>不好意思,不存在峰谷</h2></span></center></c:if>
</div>
</c:if>
<c:if test="${requestScope.peakValleyPath=='1' }"><center><span style="color:red"><h2>数据长度不够</h2></span></center></c:if>
<c:if test="${requestScope.peakValleyPath=='2' }"><center><span style="color:red"><h2>数据不完整</h2></span></center></c:if>
<c:if test="${requestScope.peakValleyPath=='3' }"><center><span style="color:red"><h2>没有数据,无法生成图片</h2></span></center></c:if>
</div>
</c:if>
[color=blue]//第二次使用ajax输出结果的代码[/color]
<c:if test="${not empty requestScope.peakValleyOrderResultList }">
<div>
<table class="table1" cellspacing="0" cellpadding="8" width="" align="center">
<tr><td class="td3" width="150px" align="center"><div align="center">峰谷分析结果:</div></td>
<c:forEach var="peakValleyOrderResult" items="${requestScope.peakValleyOrderResultList }">
<td class="td3" width="150px">峰平均阶数为${peakValleyOrderResult.peakOrder },标准差为${peakValleyOrderResult.peakStdev };谷平均阶数为${peakValleyOrderResult.valleyOrder },标准差为${peakValleyOrderResult.valleyStdev }
<input type="hidden" name="peakValleyResult" value="峰平均阶数为${peakValleyOrderResult.peakOrder },标准差为${peakValleyOrderResult.peakStdev };谷平均阶数为${peakValleyOrderResult.valleyOrder },标准差为${peakValleyOrderResult.valleyStdev }"/>
</td>
</c:forEach>
</tr>
<tr><td colspan="2" align="center">
<div><button class="ManagerButton" type="button" onClick="javascript:dealWithIndicatorValue('savePeakValleyResultToDB','${param.frequency}');">保存分析结果</button></div>
</td></tr>
</table>
</div>
</c:if>