http://taichi.blogbus.com/logs/11942994.html

解决方案 »

  1.   

    不可能强制弹出来的
    因为执不执行JS是流览器的事,可以手动关掉JS不可能用代码强制执行的
      

  2.   

    http://topic.csdn.net/u/20090105/22/8AA3724D-702D-4175-83A8-0AA7090A9605.html
      

  3.   

    我原先做过,我把html、js、css代码分别粘在下面你直接拿去就可以用了我js是用jquery写的,你在下载个jquery累库<div id="popupContact">
            <a id="popupContactClose">x</a>
            <fieldset>
                <legend>修改类别</legend>
                <dl>
                    <dt>标题</dt><dd class="inputlist-flow"><input id="edit_type_title" type="text" style="width: 225px" />
                    </dd>
                    <dt>描述</dt><dd class="inputlist-flow"><textarea id="edit_type_desc" style="width: 387px; height: 147px;"></textarea>
                    </dd>
                    <dt></dt>
                    <dd class="inputlist-flow">
                        <input id="ck_edit" type="checkbox" checked=checked />是否可见
                    </dd>
                    <dt></dt>
                    <dd class="inputlist-flow" style="text-align:center; margin-left:auto; margin-right:auto;">
                        <input id="btn_edit" class="button_bak" type="button" value="修改" />
                    </dd>
                     <dt id="status_bar" style="text-align:center; margin-left:auto; margin-right:auto;"></dt>
                </dl>
            </fieldset>       
        </div>
    $(document).ready(function(){

    var t_id;
    var t_isvisible;
    var s_title;
    var s_descript;

    //LOADING POPUP for self set
    //Click the button event!
    $(".button_window").click(function(){
    //centering with css
    centerPopup();
    //load popup
    loadPopup();

    //get type id
    t_id = this.getAttribute("typeid");
    //get is visible 0 or 1
    t_isvisible = this.getAttribute("isvisible");
    if(t_isvisible == "1")
        $("#ck_edit").attr("checked",true);
    else
        $("#ck_edit").attr("checked",false);

    //get type title
    s_title = TrimStr(document.getElementById("t_title_"+t_id).innerHTML);
    //get type descript
    s_descript = TrimStr(document.getElementById("t_desc_"+t_id).innerHTML);

    $("#edit_type_title").attr('value',s_title);
    $("#edit_type_desc").attr('value',s_descript);

    var arrayPageScroll = getPageScroll();
            var arrayPageSize = getPageSize();
            var topsize = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 384) / 2) + 'px';
            $("#popupContact").css("top",topsize);
            
            $("#backgroundPopup").css("width",self.innerHeight ? "100%" :  arrayPageSize[0]+"px");
        $("#backgroundPopup").css("height",(self.innerHeight ? arrayPageSize[1] : arrayPageSize[1] )+ "px");
            

    });

    //send data to server
    $("#btn_edit").click(function(){
         
         if(TrimStr($("#edit_type_title").attr('value')) == "")
         {
            alert('标题不能为空');
            return;
         }
         if(TrimStr($("#edit_type_desc").attr('value')) == "")
         {
            alert('描述不为空');
            return;
         }
         
         
         $("#status_bar")[0].innerHTML = "<span><img src='images/indicator.gif' alt='loading....' />正在修改中,请稍候</span>"
         
         var p_isvisible = 0;
         if($("#ck_edit")[0].checked)
            p_isvisible = 1;
         
         $.ajax({
            type:"POST",
            url:"ajaxpages/EditBlogType.aspx",
            data:"typeid=" + t_id+ "&isvisible=" + p_isvisible + "&title=" + $("#edit_type_title").attr('value') + "&desc=" + $("#edit_type_desc").attr('value'),
            success:function(msg){
                $("#status_bar")[0].innerHTML = "";
                disablePopup();
                window.location = "MyBlogType.aspx";
            }  
         });
        
    });


    //CLOSING POPUP
    //Click the x event!
    $("#popupContactClose").click(function(){
    disablePopup();
    });
    //Click out event!
    $("#backgroundPopup").click(function(){
    disablePopup();
    });
    //Press Escape event!
    $(document).keypress(function(e){
    if(e.keyCode==27 && popupStatus==1){
    disablePopup();
    }
    });});
    ////*************************************//////////
    #popupContact{
    display:none;
    position:fixed;
    _position:absolute; /* hack for internet explorer 6*/
    height:408px;
    width:408px;
    background:#FFFFFF;
    border:2px solid #cecece;
    z-index:2;
    padding:12px;
    font-size:13px;
    }
    #popupContact h1{
    text-align:left;
    color:#6FA5FD;
    font-size:22px;
    font-weight:700;
    border-bottom:1px dotted #D3D3D3;
    padding-bottom:2px;
    margin-bottom:20px;
    }
    #popupContactClose{
    font-size:14px;
    line-height:14px;
    right:6px;
    top:4px;
    position:absolute;
    color:#6fa5fd;
    font-weight:700;
    display:block;
    }
      

  4.   

    还漏了一段js代码function getPageScroll(){ var yScroll; if (self.pageYOffset) {
    yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop){  // Explorer 6 Strict
    yScroll = document.documentElement.scrollTop;
    } else if (document.body) {// all other Explorers
    yScroll = document.body.scrollTop;
    } arrayPageScroll = new Array('',yScroll) 
    return arrayPageScroll;
    }function getPageSize(){

    var xScroll, yScroll;

    if (window.innerHeight && window.scrollMaxY) {
    xScroll = document.body.scrollWidth;
    yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
    xScroll = document.body.scrollWidth;
    yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
    xScroll = document.body.offsetWidth;
    yScroll = document.body.offsetHeight;
    }

    var windowWidth, windowHeight;
    if (self.innerHeight) { // all except Explorer
    windowWidth = self.innerWidth;
    windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
    }

    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
    pageHeight = windowHeight;
    } else { 
    pageHeight = yScroll;
    } // for small pages with total width less then width of the viewport
    if(xScroll < windowWidth){
    pageWidth = windowWidth;
    } else {
    pageWidth = xScroll;
    }
    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
    return arrayPageSize;
    }
      

  5.   

    http://topic.csdn.net/u/20090105/22/8AA3724D-702D-4175-83A8-0AA7090A9605.html
      

  6.   

    用div层或者window.showModalDialog()