button按钮在这段js里面不激发事件
js代码
function show_hiddendiv(){
document.getElementById("lpInfo").style.display='block';
}
function closeWindow(){
document.getElementById("lpInfo").style.display='none';
}
function show_hiddendiv2(){
document.getElementById("sbox").style.display='none';
document.getElementById("cbox").style.display='block';
}
var isIe=(document.all)?true:false;
//设置select的可见状态
function setSelectState(state)
{
var objl=document.getElementsByTagName('select');
for(var i=0;i<objl.length;i++)
{
objl[i].style.visibility=state;
}
}
function mousePosition(ev)
{
if(ev.pageX || ev.pageY)
{
return {x:ev.pageX, y:ev.pageY};
}
return {x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop - document.body.clientTop};
}
//弹出方法
function showMessageBox(wTitle,content,pos,wWidth,hHeight)
{
closeWindow();
var bWidth=parseInt(document.documentElement.scrollWidth);
var bHeight=parseInt(document.documentElement.scrollHeight);
var vHeight=parseInt(window.screen.availHeight);//屏幕可用工作区高度
var vWidth=parseInt(window.screen.availWidth);//屏幕可用工作区宽度
var sHeight=parseInt(window.screenTop);//网页正文部分上
if(isIe){
setSelectState('hidden');}
var back=document.createElement("loup");
back.id="back";
var styleStr="top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";
styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";
back.style.cssText=styleStr;
document.body.appendChild(back);
showBackground(back,50);
var mesW=document.createElement("loup");
mesW.id="mesWindow";
mesW.className="mesWindow";
mesW.innerHTML=content;
//判断浏览器是否是firefox ie
window["MzBrowser"]={};
(function()
{
if(MzBrowser.platform) return;
var ua = window.navigator.userAgent;
MzBrowser.platform = window.navigator.platform;
MzBrowser.firefox = ua.indexOf("Firefox")>0;
})();
if(MzBrowser.firefox)
{
styleStr="left:"+(((pos.x-wWidth)>0)?(pos.x-wWidth):pos.x)+"px;top:"+pos.y+"px;position:absolute;width:"+wWidth+"px;";
}else
{
styleStr="left:"+(((pos.x-wWidth)>0)?(pos.x-wWidth):pos.x)+"px;top:"+(Number(pos.y)+Number(document.documentElement.scrollTop))+"px;position:absolute;width:"+wWidth+"px;";
}
var aaaa=(vWidth-wWidth)/2;
var bbb=(vHeight-sHeight-hHeight)/2;
//styleStr="left:"+(vWidth-wWidth)/2+"px;top:"+(vHeight-sHeight-hHeight)/2+"px;position:absolute;width:"+wWidth+"px;";
mesW.style.cssText=styleStr;
document.body.appendChild(mesW);
}
//让背景渐渐变暗
function showBackground(obj,endInt)
{
if(isIe)
{
obj.filters.alpha.opacity+=1;
if(obj.filters.alpha.opacity<endInt)
{
setTimeout(function(){showBackground(obj,endInt)},5);
}
}else{
var al=parseFloat(obj.style.opacity);al+=0.01;
obj.style.opacity=al;
if(al<(endInt/100))
{setTimeout(function(){showBackground(obj,endInt)},5);}
}
}
//关闭窗口
function closeWindow()
{
if(document.getElementById('back')!=null)
{
document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
}
if(document.getElementById('mesWindow')!=null)
{
document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));
}
if(isIe){
setSelectState('');}
}
//测试弹出
function testMessageBoxmy(ev,divid)
{
var objPos = mousePosition(ev);
messContent=document.getElementById(divid).innerHTML;
showMessageBox('窗口标题',messContent,objPos,280,0);
}
页面
<div id="dd" style="display: none">
<div class="dlost">
<div style="float:right;">
<a href="javascript:closeWindow()">
<img src="img/close1.gif" />
</a>
<div style="clear:both;"></div>
</div>
<p class="dzeng">
<img class="dll" src="img/businessman.png" />
增加 </p>
<p class="dtt">
说明:
<textarea class="dtea" name="" cols="" rows=""></textarea>
</p>
<p class="dt">
上传:
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</p>
<p class="ddein">
</p>
<p class="dlastt">
<a href="#"><img src="img/submitted.png" /></a>
<a href="javascript:closeWindow()"><img src="img/cancel.png" /></a>
</p>
</div>
</div>