自定义的WEB对话框,非常漂亮

  protected   void  Page_Load( object  sender, EventArgs e)
    {

        ShowWindow(
" 我的天啊真漂亮 " 600 400 " Pop.aspx " );

    }

    
public   static   void  ShowWindow( string  title,  int  width,  int  height,  string  url)
    {
        StringBuilder str 
=   new  StringBuilder();

        str.Append(
" <div id='formDiv' style='display:;Z-INDEX:100;FILTER:alpha(Opacity=40);LEFT:0px;WIDTH:100%;POSITION:absolute;TOP:0px;HEIGHT:100%;BACKGROUND-COLOR:lightgrey'> " );
        str.Append(
" <table width='100%' height='100%' cellpadding='0' cellspacing='0' border='0'> " );
        str.Append(
" <tr > " );
        str.Append(
" <td></td> " );
        str.Append(
" </tr> " );
        str.Append(
" </table> " );
        str.Append(
" </div> " );

        str.Append(
" <div id='arltDiv' align='center' style='display:;Z-INDEX: 101;WIDTH:  "   +  width.ToString()  +   " px; POSITION: absolute; HEIGHT:  "   +  height.ToString()  +   " px'> " );
        str.Append(
" <table width='100%' height='100%' cellpadding='0' cellspacing='0' align='center' > " );
        str.Append(
" <tr style='background-image:url(Images/Xp_background.gif); height:30px'> " );
        str.Append(
" <td   align='left' valign='middle' style=' font-size:13px; font-weight:bold; color:White; font-family: 宋体'>&nbsp;&nbsp;<b> "   +  title  +   " </b></td> " );
        str.Append(
" <td   align='right' valign='middle'><img alt='关闭' src='Images/b_close_2.gif'  οnmοuseοver='imageUp1(this);' οnmοuseοut='imageUp2(this);' οnclick='hideDiv()'/>&nbsp;</td> " );
        str.Append(
" </tr> " );
        str.Append(
" <tr> " );
        str.Append(
" <td  colspan='2' bgcolor='#ffffff' align='center' width='100%' style='border-right: #9999ff 3px ridge; border-top: #9999ff 0px ridge; border-left: #9999ff 3px ridge; border-bottom: #9999ff 3px ridge;'> " );
        str.Append(
" <iframe  width='98%' height='98%' scrolling='no' src=' "   +  url  +   " ' frameborder='0' style='border:0px'></iframe> " );
        str.Append(
" </tr> " );

        str.Append(
" </table> " );
        str.Append(
" </div> " );

        str.Append(
" <script type='text/javascript'> " );
        str.Append(
" var width_c= "   +  width.ToString()  +   " ; " );
        str.Append(
" var height_c= "   +  height.ToString()  +   " ; " );
        str.Append(
" var sw = screen.width; " );
        str.Append(
" var sh = screen.height; " );
        str.Append(
" var left = (sw - width_c)/2; " );
        str.Append(
" var top = (sh - height_c)/2-50; " );

        str.Append(
" document.getElementById('arltDiv').style.top=top; " );
        str.Append(
" document.getElementById('arltDiv').style.left=left; " );

        str.Append(
" function hideDiv(){ " );
        str.Append(
" document.getElementById('formDiv').style.display='none'; " );
        str.Append(
" document.getElementById('arltDiv').style.display='none'; " );
        str.Append(
" } " );

        str.Append(
" function imageUp1(img){ " );
        str.Append(
" img.src='Images/b_close_1.gif'; " );
        str.Append(
" } " );

        str.Append(
" function imageUp2(img){ " );
        str.Append(
"  img.src='Images/b_close_2.gif'; " );
        str.Append(
" } " );

        str.Append(
" </script> " );

        HttpContext.Current.Response.Write(str);
    }
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值