没有错误的错误,真的令人很头痛 是否你定义了div的style的宽度、高度? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 找到原因了,还是不可理喻,如果注释掉CheckBtn函数调用,就可以正常显示,请高手给个合理解释,IE的bug?还是不允许在button的disabled属性设置后再在div里写html?源代码如下:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>模板编辑</title> <style> .{font-size:12px} </style> <script language="javascript">function getElementById(s){ if (document.getElementById) return(document.getElementById(s)); if (document.all) return(document.all(s)); try { return(eval(s)); } catch(E) { return(null); }}function CheckBtn(frm, me){ var tt = me.selectedIndex; if (tt==-1) { frm.delbtn.disabled = true; frm.uppbtn.disabled = true; frm.lowbtn.disabled = true; } else if (me.options.length==1) { frm.delbtn.disabled = false; frm.uppbtn.disabled = true; frm.lowbtn.disabled = true; } else { frm.delbtn.disabled = false; frm.uppbtn.disabled = (tt==0); frm.lowbtn.disabled = (tt==me.options.length-1); }}function ShowDetail(frm, me){ var dst = getElementById("FrameHint"); var tt = me.selectedIndex; if (tt==-1) { dst.innerHTML = '<font color="#FF0000">单击模板元素,获得元素明细</font>'; } else if (me.options.length==1) { dst.innerHTML = me.options[tt].text.replace(/[&]{2}/g, '<br/>'); } else { dst.innerHTML = me.options[tt].text.replace(/[&]{2}/g, '<br/>'); }}function ShowFrame(frm, me){ CheckBtn(frm, me);//如果注释掉这段代码,就可以显示正常 ShowDetail(frm, me);} </script> </head> <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" style="overflow:auto"> <form name="a_form" action="?Handle=Add" method="post"> <table width="790" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" bgcolor="#F4FAFF" bordercolordark="#FFFFFF" bordercolorlight="#0080C0"> <tr class="trhd"> <td colspan="4">添加新模板(带*号的项目必须输入)</td> </tr> <tr class="trbd"> <td width="100" class="tdbd">模板名称</td> <td width="690" colspan="3"><input type="text" name="Name" size="30" class="txt" /></td> </tr> <tr class="trbd"> <td width="100" class="tdbd">选择API</td> <td width="300" align="center"> <div>API</div> <select name="APIList" size="15" style="width:299; font-size:12px" onChange="ShowIntro(this)"> </select> </td> <td width="90" align="center" valign="middle"> <div style="padding-top:5px"><input type="button" value="添加>>" class="btn" onClick="ShowForm(this.form, 'Add')" /></div> <div style="padding-top:5px"><input type="button" value="追加>>" class="btn" onClick="ShowForm(this.form, 'Append')" /></div> <div style="padding-top:5px"><input type="button" value="替换>>" class="btn" onClick="ShowForm(this.form, 'Replace')" /></div> <div style="padding-top:5px"><input type="button" name="delbtn" value="删除" class="btn" onClick="MoveFrame(this.form, 'delete')" disabled="true" /></div> <div style="padding-top:5px"><input type="button" name="uppbtn" value="上移" class="btn" onClick="MoveFrame(this.form, 'upper')" disabled="true" /></div> <div style="padding-top:5px"><input type="button" name="lowbtn" value="下移" class="btn" onClick="MoveFrame(this.form, 'lower')" disabled="true" /></div> </td> <td width="300" align="center"> <div>模板元素</div> <select name="FrameList" size="15" style="width:299; font-size:12px" onChange="ShowFrame(this.form, this)"> <option value="ExportSiteLogo">ExportSiteLogo(center)&&ExportSiteLogo(center)</option> <option value="ExportSiteLogo">ExportSiteLogo(center)&&ExportSiteLogo(center)</option> </select> </td> </tr> <tr class="trbd"> <td width="100" class="tdbd">模板元素明细</td> <td width="690" colspan="3"><div id="FrameHint" style="overflow-y:auto; width:690; height:60; color:#006600"><font color="#FF0000">单击模板元素,获得元素明细</font></div></td> </tr> <tr class="trbd"> <td width="100" class="tdbd">API搜索</td> <td width="690" colspan="3"><input type="text" name="key" size="20" class="txt" /> <input type="button" value="搜索" onClick="CallQuery(this.form, this)" class="btn" /></td> </tr> <tr class="trbd"> <td colspan="4" align="center"><input type="button" value="确定添加" class="btn" onClick="CallAdd(this.form,this)" /></td> </tr> </table> </form> </body></html> me.options.[tt].text的值"aaa(x)&&bbb(y)"经过替换后是aaa(x)<br/>bbb(y),但是dst.innerHTML只显示aaa(x),bbb(y)却无法看到,alert(dst.innerHTML)可以看到值是aaa(x)<br/>bbb(y)dst.innerHTML 换成 dst.innerText试试 innerText就是显示aaa(x)<br/>bbb(y)但是用innerHTML就只显示aaa(x)可以随意测试,我换了好几台电脑的IE浏览器都是一样的结果,我开始以为是我的电脑有病毒了导致IE显示不正常 问题找到了,是div的overflow-y样式影响的,整个过程可以总结了,就是:因为设置了input.button的disabled属性,导致div.style.overflowY样式影响div.innerHTML入口失常这是IE的bug么?解决方法:用getElementById获取对象后,设置:dst.style.overflowY = "auto";方可使用,真是画蛇也要添个足才可以 GoogleMap的marker不更新,急死人。求助 google ajax api问题 JS走马灯效果 My97DatePicker日期控件为什么不支持IE浏览器?这个东西要怎么用? 无刷新的图片上传怎么弄 一个比较复杂的时间比较问题 就是登录时IE记忆了密码,如何用程序将其取消 javascript修改table的问题 关于修改第三方js ui 是否违法? 問題很簡單,請幫我看一下:這個頁面為什麼一按刪除按鈕就會出錯呢? 关于JS里得到一个ASP的变量的问题 ? 提取某个字符串中特定的内容
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>模板编辑</title>
<style>
.{font-size:12px}
</style>
<script language="javascript">
function getElementById(s)
{
if (document.getElementById) return(document.getElementById(s));
if (document.all) return(document.all(s));
try
{
return(eval(s));
}
catch(E)
{
return(null);
}
}function CheckBtn(frm, me)
{
var tt = me.selectedIndex;
if (tt==-1)
{
frm.delbtn.disabled = true;
frm.uppbtn.disabled = true;
frm.lowbtn.disabled = true;
}
else if (me.options.length==1)
{
frm.delbtn.disabled = false;
frm.uppbtn.disabled = true;
frm.lowbtn.disabled = true;
}
else
{
frm.delbtn.disabled = false;
frm.uppbtn.disabled = (tt==0);
frm.lowbtn.disabled = (tt==me.options.length-1);
}
}function ShowDetail(frm, me)
{
var dst = getElementById("FrameHint");
var tt = me.selectedIndex;
if (tt==-1)
{
dst.innerHTML = '<font color="#FF0000">单击模板元素,获得元素明细</font>';
}
else if (me.options.length==1)
{
dst.innerHTML = me.options[tt].text.replace(/[&]{2}/g, '<br/>');
}
else
{
dst.innerHTML = me.options[tt].text.replace(/[&]{2}/g, '<br/>');
}
}function ShowFrame(frm, me)
{
CheckBtn(frm, me);//如果注释掉这段代码,就可以显示正常
ShowDetail(frm, me);
}
</script>
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" style="overflow:auto">
<form name="a_form" action="?Handle=Add" method="post">
<table width="790" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" bgcolor="#F4FAFF" bordercolordark="#FFFFFF" bordercolorlight="#0080C0">
<tr class="trhd">
<td colspan="4">添加新模板(带*号的项目必须输入)</td>
</tr>
<tr class="trbd">
<td width="100" class="tdbd">模板名称</td>
<td width="690" colspan="3"><input type="text" name="Name" size="30" class="txt" /></td>
</tr>
<tr class="trbd">
<td width="100" class="tdbd">选择API</td>
<td width="300" align="center">
<div>API</div>
<select name="APIList" size="15" style="width:299; font-size:12px" onChange="ShowIntro(this)">
</select>
</td>
<td width="90" align="center" valign="middle">
<div style="padding-top:5px"><input type="button" value="添加>>" class="btn" onClick="ShowForm(this.form, 'Add')" /></div>
<div style="padding-top:5px"><input type="button" value="追加>>" class="btn" onClick="ShowForm(this.form, 'Append')" /></div>
<div style="padding-top:5px"><input type="button" value="替换>>" class="btn" onClick="ShowForm(this.form, 'Replace')" /></div>
<div style="padding-top:5px"><input type="button" name="delbtn" value="删除" class="btn" onClick="MoveFrame(this.form, 'delete')" disabled="true" /></div>
<div style="padding-top:5px"><input type="button" name="uppbtn" value="上移" class="btn" onClick="MoveFrame(this.form, 'upper')" disabled="true" /></div>
<div style="padding-top:5px"><input type="button" name="lowbtn" value="下移" class="btn" onClick="MoveFrame(this.form, 'lower')" disabled="true" /></div>
</td>
<td width="300" align="center">
<div>模板元素</div>
<select name="FrameList" size="15" style="width:299; font-size:12px" onChange="ShowFrame(this.form, this)">
<option value="ExportSiteLogo">ExportSiteLogo(center)&&ExportSiteLogo(center)</option>
<option value="ExportSiteLogo">ExportSiteLogo(center)&&ExportSiteLogo(center)</option>
</select>
</td>
</tr>
<tr class="trbd">
<td width="100" class="tdbd">模板元素明细</td>
<td width="690" colspan="3"><div id="FrameHint" style="overflow-y:auto; width:690; height:60; color:#006600"><font color="#FF0000">单击模板元素,获得元素明细</font></div></td>
</tr>
<tr class="trbd">
<td width="100" class="tdbd">API搜索</td>
<td width="690" colspan="3"><input type="text" name="key" size="20" class="txt" /> <input type="button" value="搜索" onClick="CallQuery(this.form, this)" class="btn" /></td>
</tr>
<tr class="trbd">
<td colspan="4" align="center"><input type="button" value="确定添加" class="btn" onClick="CallAdd(this.form,this)" /></td>
</tr>
</table>
</form>
</body>
</html>
dst.innerHTML 换成 dst.innerText试试
但是用innerHTML就只显示aaa(x)可以随意测试,我换了好几台电脑的IE浏览器都是一样的结果,我开始以为是我的电脑有病毒了导致IE显示不正常
因为设置了input.button的disabled属性,导致div.style.overflowY样式影响div.innerHTML入口失常这是IE的bug么?解决方法:
用getElementById获取对象后,设置:
dst.style.overflowY = "auto";
方可使用,真是画蛇也要添个足才可以