首页 新闻 会员 周边 捐助

点2次才起作用。

0
悬赏园豆:100 [已关闭问题]
<DIV class=Content> <P>描述:<BR>1:一个页面有三层z-index[1,2,3]<BR>div1:有个按钮OpenDiv,当点击时,弹出div2[遮罩层zindex=2]和一个动态createElement("table")[zindex=3]<BR>2:table里有一个按钮[type=button],点击这个按钮div2和table都被remove掉</P> <P><BR>&nbsp;&nbsp;&nbsp; //删除遮蔽层 EnvelopLayer<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var layerBeta=document.getElementById("EnvelopLayer");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layerBeta.parentNode.removeChild(layerBeta);<BR>&nbsp;&nbsp;&nbsp; //删除table<BR>&nbsp;&nbsp;&nbsp; var divid=2;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var tbl=document.getElementById("Window_"+divid);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tbl.parentNode.removeChild(tbl);</P> <P>3:这个页面是aspx页面<BR>问题:这个按钮点2次才起作用。不知道为什么?<BR>如果是html页面,点击一次就会起作用。<BR>可为什么aspx页面就2次呢?</P> <P><BR>note:&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<A href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" mce_href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><FONT color=#0000ff>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</FONT></A>"&gt;<BR>&lt;html xmlns="<A href="http://www.w3.org/1999/xhtml" mce_href="http://www.w3.org/1999/xhtml"><FONT color=#0000ff>http://www.w3.org/1999/xhtml</FONT></A>"&gt;都一样.<BR></P> <P>部分js代码</P> <P>建立遮罩层</P> <P>function createEnvelopLayer()<BR>{<BR>&nbsp;&nbsp;&nbsp; var h=document.documentElement.clientHeight;<BR>&nbsp;&nbsp;&nbsp; var w=document.documentElement.clientWidth;<BR>&nbsp;&nbsp;&nbsp; var div=document.createElement("&lt;div id='EnvelopLayer' style='position:absolute;visibility:visible;background:#000;filter:alpha(opacity=20);z-index:500;left:0;top:0;width:"+w+"px;height:"+h+"px;color:#fff'&gt;&lt;/div&gt;");<BR>&nbsp;&nbsp;&nbsp; div.id="EnvelopLayer";<BR>&nbsp;&nbsp;&nbsp; document.body.appendChild(div);<BR>}</P> <P mce_keep="true">&nbsp;</P> <P>//create table</P> <P>this.oTable = document.createElement("table");<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; this.oTable.id = "Window_" + this.id;<BR>&nbsp;<BR>&nbsp;this.oTable.style.width = this.width + "px";<BR>&nbsp;//this.oTable.style.height = "100px";<BR>&nbsp;//set zIndex<BR>&nbsp;this.oTable.style.zIndex="1000"<BR>&nbsp;<BR>&nbsp;//this.oTable.style.width = "100%";<BR>&nbsp;//this.oTable.style.height = document.body.scrollHeight<BR>&nbsp;//this.oTable.style.border = "1px solid #C2C3BD";<BR>&nbsp; this.oTable.cellSpacing = 0;<BR>&nbsp;//this.oTable.cellPadding = 2;<BR>&nbsp;this.oTable.cellPadding = 0;<BR>&nbsp;//this.oTable.border = 0;<BR>&nbsp;//this.oTable.style.backgroundColor = "#FFFFFF";</P> <P>&nbsp;// determine the windows position when first open<BR>&nbsp;this.oTable.style.position = "absolute";<BR>&nbsp;this.oTable.style.left = this.x + "px";<BR>&nbsp;this.oTable.style.top = this.y + "px";</P> <P>&nbsp;// link from the table to the JSWindow object<BR>&nbsp;this.oTable.jsWindow = this;</P> <P>&nbsp;// if the table is clicked anywhere, show the table in front of other open windows<BR>&nbsp;this.oTable.onmousedown = JSWindow.prototype.onBringToFront;<BR>&nbsp;&nbsp;&nbsp; this.oTable.className="tanchu";</P> <P mce_keep="true">&nbsp;</P> <P mce_keep="true">this.oContentTD.innerHTML = document.all["Div" + this.id].innerHTML;</P></DIV>
roboth的主页 roboth | 初学一级 | 园豆:28
提问于:2008-06-29 14:25
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册