<script language="javascript">
function sea(){
if (wew.style.display=="none"){
wew.style.display="";
}
else{
wew.style.display="none";
}
}
</script> 这 是原来的代码
function sea(){
if (wew.style.display=="none"){
wew.style.display="";
}
else{
wew.style.display="none";
}
}
</script> 这 是原来的代码
<body>
<div id="wew" style="position:absolute; left:156px; top:113px; width:131px; height:55px; z-index:1; background-color: red; layer-background-color: #FF0000; border: 1px none #000000; display:none">dddddddddddd</div>
111111
</body>
<script language="javascript">
document.body.onclick=function(){sea()}
function sea(){
wew.style.display="";
alert("sdf");
}
</script>
pElement.appendChild(div);
<script language="javascript">
document.onclick=function(){sea()}
function sea(){
wew.style.display="";
alert("sdf");
}
</script><div id="wew" style="position:absolute; left:156px; top:113px; width:131px; height:55px; z-index:1; background-color: red; layer-background-color: #FF0000; border: 1px none #000000; display:none">dddddddddddd</div>2.动态添加:
<script language="javascript">
var div=document.createElement("<div id=\"wew\" style=\"position:absolute; left:156px; top:113px; width:131px; height:55px; z-index:1; background-color: red; layer-background-color: #FF0000; border: 1px none #000000;display:none\">dddddddddddd</div>");document.onclick=function(){sea()}
function sea(){
wew.style.display="";
alert("sdf");
}
</script>
<body>
</body>
<script>
document.body.appendChild(div);
</script>
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function showDiv(){
var div;
var mydiv=document.all.divHide;
var pElement=document.body;
div = "<table width=\"50\" height=\"102\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FF0000\"><tr>"
div = div+"<td> </td><td>sea</td></tr></table>"
if(!mydiv)
{
mydiv=document.createElement("<DIV id=divHide style='left:100;top:0;overflow:hidden;position:absolute;visibility:hidden'></DIV>");
pElement.appendChild(mydiv);
}
mydiv.onblur=hidePicker;
mydiv.innerHTML="<IFRAME id=IFPicker width=100% height=100%></IFRAME>";
//alert(mydiv.innerHTML);
var doc=frames("IFPicker").document;
doc.open();
//doc.write(div);
doc.write("<body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 style='overflow:hidden;border:none'>"+div+"</body>");
doc.close();
var style=mydiv.style;
var width=200,height=150;
style.width=width;
style.height=height;
style.visibility="visible";
mydiv.focus();
}
//隐藏层
function hidePicker()
{
var e=document.activeElement;
var mydiv=document.all.divHide;
if(e.id=="IFPicker")
{
mydiv.focus();
return;
}
mydiv.style.visibility = 'hidden';
}
</script>
<title>无标题文档</title>
</head><body>
<input name="lookshow" type="text" id="lookshow">
<input type="button" name="Submit" value="按钮" onClick="showDiv()"></body>
</html>
谢谢各位,我已经测试出来了