a.jsp如果引用了b.jsp. 同时b.jsp中包含了<script>脚本. IE下效果不正常.

首先是a.jsp的页面代码, 引用了b.jsp. 引入了ext的css和js. 引入自己创建的一个js:
[code="jsp"]
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="b.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">







[/code]

接着是b.jsp, 里面有一个空的标签
[code="jsp"]
<%@ page contentType="text/html; charset=UTF-8" language="java" %>

[/code]

没啥问题吧. 最后是我的a.js. a.js中定义的radio[color=red]只在IE下会出问题[/color].
[code="js"]
function generateRadio(num)
{
var array = new Array();

for(var i = 0; i < num; i++)
{
    var radio = new Ext.form.Radio({
        boxLabel:   '第' + (1 + i) + '个'
        ,columnWidth:.25
    });
    array.push(radio);  
}
return new Ext.Panel({layout:'column', items:array});

}

Ext.onReady(function(){
var panelLeft = new Ext.Panel({
items:[
{xtype:'panel', html:'I am htmllll' +
'llllllllllllllllllllllllll' +
'llllllllllllllllllllllllll' +
'llllllllllllllllllllllllll' +
'llllllllllllllllllllllllll' +
'llllllllllllllllllllllllll' +
'lllllllllll'}
,generateRadio(10) // 生成有10个radio的panel
]
});

var panelRight = new Ext.Panel({});

var panel = new Ext.Panel({
    layout:'column'
    ,defaults:{columnWidth:.5}
    ,items:[panelLeft, panelRight]
});

panel.render(document.body);

});
[/code]

这种情况下. IE下radio会被挡住一些.参考效果
[img]http://dl.iteye.com/upload/attachment/191343/9b9341e9-0dca-3ae1-b2d7-3315b7b2a585.jpg[/img]

[color=red]如果, 把b.jsp中的标签去掉. 效果就正常了:[/color]
[img]http://dl.iteye.com/upload/attachment/191345/dd2f0123-80a2-396f-bfe4-a92be5482a73.jpg[/img]

其他浏览器OK. 为啥IE就是万恶之源呢... 求解决办法...

1个回答

<%@ include file="b.jsp"%> 丢到header中去。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!