没怎么明白意思
根据这句话:“后面的操作想把这行字去掉,换成一个表格。”
var showObj = document.getElementById("iList");
showObj.document.getElementById("layerWindowShowArea").innerHTML = "你想换的表格";
根据这句话:“后面的操作想把这行字去掉,换成一个表格。”
var showObj = document.getElementById("iList");
showObj.document.getElementById("layerWindowShowArea").innerHTML = "你想换的表格";
例如一个表格<table...</table>
报错,说缺少对象
showObj.contentWindow.document //contentWindow 通过ID访问 iframe 的时候
var showObj = document.getElementById("iList");
alert(showObj.id)
iframeObj = showObj.contentWindow;
if(iframeObj){
alert(iframeObj.document.body.innerHTML);
iframeObj.document.body.innerHTML="你要的内容";
}
}调试通过;来晚了一步。
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="content-type" content="text/html" charset="GB2312">
<link rel="stylesheet" type="text/css" href="">
<script type="text/javascript" src=""></script></HEAD><BODY>
<span id="showlayer"></span>
</BODY>
</HTML>
<script language="javascript" type="text/javascript">
var nullframe = '<HTML><BODY BGCOLOR=#FFFFFF text=#000000>'
+ '<div id="layerWindowShowArea"><center><H3 color=#ffffff>正在读取资料, 请稍候 ......</h3></center></div>'
+ '</BODY></HTML>';
function ShowLayerWindow_3(title,w,h)
{
var ShowLayerInfo = "<DIV id=READ style=\"FILTER: revealTrans(transition=23,duration=0.5) blendTrans(duration=0.5); LEFT: 100px; POSITION: absolute; TOP: 75px; WIDTH: "+w+"; Z-INDEX: 10\">"
+"<center>"
+"<table width='90%' border=1 cellpadding='0' cellspacing='0' bordercolorlight='#5E9BF7' bordercolordark='#FFFFFF' >"
+" <tr bgcolor='#ffedc8' height='28'>"
+" <td colspan='1'><DIV id=\"div\" onmouseout=drag=0 onmouseover=\"dragObj=READ; drag=1;move=0\" onclick=\"editit(this);return true;\">"+title+"</div></td>"
+" <td width=1%><A href='javascript:void(Hide(READ))'>×</A></td>"
+" </tr>"
+" <tr>"
+" <td colspan='4' bgcolor=#cccccc>"
+" <table width=100% border=0 cellspacing=4><tr><td>"
+" <iframe id='iList' name='iList' src='javascript:parent.nullframe' width='"+w+"' height='"+h+"'></iframe>"
+" </td></tr></table>"
+" </td></tr></table>"
+"</div>";
document.all.showlayer.innerHTML = ShowLayerInfo;
}
ShowLayerWindow_3('hello', 300, 200);function editit(obj)
{
var editble = obj.isContentEditable;
var nflag = editble?false:true;
obj.contentEditable = nflag;
obj.style.background = '#3399FF';
obj.onkeyup = changeit;
}function changeit()
{
var content = document.getElementById("div");
var spnode = window.frames[0].document;
var filde = spnode.getElementById("layerWindowShowArea");
filde.innerHTML = '';
filde.innerHTML = "<h3>"+content.innerText;
}
</script>
可是新问题又来了: var showObj = document.getElementById("iList");//frames["iList"];
if(showObj){
alert(showObj.id);//<--加上这句
var showObj2 = showObj.contentWindow.document.body;
if(showObj2)
showObj2.innerHTML = tmpStr;
}
如果把上面那句alert(showObj.id);去掉,那个iframe是不会填充新内容的
每次都弹一个alert出来也不行啊。
再请大侠们帮忙看看
换成 self.focus();就可以了