水滴石穿之页面遮罩层实现、向window.open()打开的窗口POST数据

来源:百度文库 编辑:神马文学网 时间:2024/04/30 06:33:36

1.页面遮罩层实现

 
   
   
                                    top:expression((document.body.offsetHeight-170)/2);background-color:#fff;display:none;" valign="center">       
   
   
  数据正在加载..
     
    
     

 

2.向window.open()打开的窗口POST数据

Code
function openWindowWithPost(url,name,keys,values)
{
    var newWindow = window.open(url, name);
    if (!newWindow)
        return false;
        
    var html = "";
    html += "";
    if (keys && values)
    {
       html += "";
    }
    
    html += "document.getElementById('formid').submit();";
    html += "<\/script>".toString().replace(/^.+?\*|\\(?=\/)|\*.+?$/gi, ""); 
    newWindow.document.write(html);
    
    return newWindow;
}

这里需要注意两点:
(1)如果需要post多个对象,那么可以在if (keys && values)增加一个循环
(2)"<\/script>".toString().replace(/^.+?\*|\\(?=\/)|\*.+?$/gi, "") 只是为了防止