现在的位置: 首页 > 综合 > 正文

asp.net弹出对话框

2013年04月19日 ⁄ 综合 ⁄ 共 2760字 ⁄ 字号 评论关闭

<a href="javascript:void(0)" onclick="showFloat()">弹出对话框</a>

<div id="doing" style="filter: alpha(opacity=30); -moz-opacity: 0.3; opacity: 0.3;
                        background-color: #000; width: 70%; height: 100%; z-index: 1000; position: absolute;
                        left: 0; top: 0; display: none; overflow: hidden;">
                    </div>
                    <!--加一个登录层-->
                    <div id="divLogin" style="border: solid 10px #898989; background: #fff; padding: 10px;
                        width: 780px; z-index: 1001; position: absolute; display: none; top: 50%; left: 50%;
                        margin: -200px 0 0 -400px;">
                        <div style="padding: 3px 15px 3px 15px; text-align: left; vertical-align: middle;">
          要弹出的层                          

                            <asp:Button ID="BtnCommite" runat="server" Text="提交留言" />&nbsp;
                            <input id="BttCancel" type="button" value="关 闭" onclick="ShowNo()" />
                        </div>

      </div>

点击事件要调用的方法

 

//弹出层
function ShowNo()                        //隐藏两个层
{
    document.getElementById("doing").style.display = "none";
    document.getElementById("divLogin").style.display = "none";
}
function $(id) {
    return (document.getElementById) ? document.getElementById(id) : document.all[id];
}
function showFloat()                    //根据屏幕的大小显示两个层
{
    var range = getRange();
    $('doing').style.width = range.width + "px";
    $('doing').style.height = range.height + "px";
    $('doing').style.display = "block";
    document.getElementById("divLogin").style.display = "";
}
function getRange()                      //得到屏幕的大小
{
    var top = document.body.scrollTop;
    var left = document.body.scrollLeft;
    var height = document.body.clientHeight;
    var width = document.body.clientWidth;

    if (top == 0 && left == 0 && height == 0 && width == 0) {
        top = document.documentElement.scrollTop;
        left = document.documentElement.scrollLeft;
        height = document.documentElement.clientHeight;
        width = document.documentElement.clientWidth;
    }
    return { top: top, left: left, height: height, width: width };
}

//检查是否至少选择了一项
function CheckHasSelectedItem() {
    var checkbox = document.all.CheckboxGroup;
    if (checkbox == null) {
        return false;
    }
    if (checkbox.length + "" != "undefined") {
        for (var i = 0; i < checkbox.length; i++) {
            if (checkbox[i].checked) {
                return true;
            }
        }
    }
    else {
        return false;
    }
}
function ConfirmDelete() {
    if (CheckHasSelectedItem()) {
        return confirm("你确认删除此信息吗?");
    }
    else {
        alert("请至少选择一项!");
        return false;
    }
}
function ConfirmTongGuo() {
    if (CheckHasSelectedItem()) {
        return confirm("你确定要推荐该学生?");
    }
    else {
        alert("请至少选择一项!");
        return false;
    }
}
function ConfirmCheXiao() {
    if (CheckHasSelectedItem()) {
        return confirm("你确定要撤销该学生?");
    }
    else {
        alert("请至少选择一项!");
        return false;
    }
}

 

抱歉!评论已关闭.