<script type="text/javascript">
function closeit_update(id,classid)

document.getElementById("frm").src = "base_update_frame.asp?id="+id+"&classid="+classid;
    shideBody();
}
function closeit(parentid,classid)

document.getElementById("frm").src = "base_add_frame.asp?parentid="+parentid+"&classids="+classid;
    shideBody();
}
var shield;
function shideBody()
{
    shield = document.createElement("DIV");
    shield.id = "shield";
    shield.style.position = "absolute";
    shield.style.left = "0px";
    shield.style.top = "0px";
    shield.style.width = "100%";
    shield.style.height = document.documentElement.scrollHeight+"px";
    shield.style.background = "#333333";
    shield.style.textAlign = "center";
    shield.style.zIndex = "10000";
    shield.style.filter = "alpha(opacity=0)";
    shield.style.opacity = 0;
    document.body.appendChild(shield);
  
    this.setOpacity = function(obj,opacity){
    if(opacity>=1)opacity=opacity/100;
    try{ obj.style.opacity=opacity; }catch(e){}
    try{
        if(obj.filters.length>0 && obj.filters("alpha")){
            obj.filters("alpha").opacity=opacity*150;
        }else{
            obj.style.filter="alpha(opacity=\""+(opacity*150)+"\")";
        }
    }catch(e){}
    }
    var c = 0;
    this.doAlpha = function(){
    if (++c > 20){clearInterval(ad);return 0;}
    setOpacity(shield,c);
    }
    var ad = setInterval("doAlpha()",1);    document.getElementById("divh").style.display = "";
    document.getElementById("divh").style.marginLeft = "-200px";
    document.getElementById("divh").style.marginTop = -75+document.documentElement.scrollTop + "px";}
function cancelShide()
{
    if(document.getElementById("divh"))
    {
        document.getElementById("divh").style.display = "none";

    }
    if(shield)
    {
        document.body.removeChild(shield);
    }
window.location=(window.location+'').replace("#","");
}
function dook(e)
{
e.style.visibility="hidden";
document.frm.document.forms[0].submit();
document.getElementById("divh").getElementsByTagName("div")[1].innerHTML = "<div style='padding:20px'>提交成功!</div>";
setTimeout("cancelShide()",1000);
}

</script>这个js提交表单后就会返回到提交的页面,但是我想做到他返回的页面能带参数
比如说返回到a.asp?id=1&classid=2
也就是说传递到处理页面去的参数,原样需要返回回来
怎么修改红色部分呢?

解决方案 »

  1.   

    <script type="text/javascript">
    function closeit_update(id,classid)

    document.getElementById("frm").src = "base_update_frame.asp?id="+id+"&classid="+classid;
        shideBody();
    }
    function closeit(parentid,classid)

    document.getElementById("frm").src = "base_add_frame.asp?parentid="+parentid+"&classids="+classid;
        shideBody();
    }
    var shield;
    function shideBody()
    {
        shield = document.createElement("DIV");
        shield.id = "shield";
        shield.style.position = "absolute";
        shield.style.left = "0px";
        shield.style.top = "0px";
        shield.style.width = "100%";
        shield.style.height = document.documentElement.scrollHeight+"px";
        shield.style.background = "#333333";
        shield.style.textAlign = "center";
        shield.style.zIndex = "10000";
        shield.style.filter = "alpha(opacity=0)";
        shield.style.opacity = 0;
        document.body.appendChild(shield);
      
        this.setOpacity = function(obj,opacity){
        if(opacity>=1)opacity=opacity/100;
        try{ obj.style.opacity=opacity; }catch(e){}
        try{
            if(obj.filters.length>0 && obj.filters("alpha")){
                obj.filters("alpha").opacity=opacity*150;
            }else{
                obj.style.filter="alpha(opacity=\""+(opacity*150)+"\")";
            }
        }catch(e){}
        }
        var c = 0;
        this.doAlpha = function(){
        if (++c > 20){clearInterval(ad);return 0;}
        setOpacity(shield,c);
        }
        var ad = setInterval("doAlpha()",1);    document.getElementById("divh").style.display = "";
        document.getElementById("divh").style.marginLeft = "-200px";
        document.getElementById("divh").style.marginTop = -75+document.documentElement.scrollTop + "px";}
    function cancelShide()
    {
        if(document.getElementById("divh"))
        {
            document.getElementById("divh").style.display = "none";

        }
        if(shield)
        {
            document.body.removeChild(shield);
        }
    window.location=(window.location+'').replace("#","");
    }
    function dook(e)
    {
    e.style.visibility="hidden";
    document.frm.document.forms[0].submit();
    document.getElementById("divh").getElementsByTagName("div")[1].innerHTML = "<div style='padding:20px'>提交成功!</div>";
    setTimeout("cancelShide()",1000);
    }

    </script>
      

  2.   

    LZ 没有搞清楚执行顺序。提交后-》后台-》客户端(重新刷新这个页面)所以你要在加载页面过程来做这件事。而不是用setTimeout("cancelShide()",1000);来做。
      

  3.   

    诶,2楼,告诉你一个秘密,其实我知道在服务端做,但是为什么就不能给js传递asp变量呢?
    只是需要返回的页面带参数的嘛
    类似这样的:<script language=javascript>alert('删除成功!');this.location.href='base_manages.asp?query=query&sel1=<%=sel1%>&sel2=<%=sel2%>&sel3=<%=sel3%>&sel4=<%=sel4%>&sel5=<%=sel5%>';</script>
    只不过这是个弹窗,没有上面我写的那种效果好
      

  4.   

    还有一个秘密,给js传递传递参数是在客户端运行。
    你这段js是服务器的 .js;
    还是是 <javascript src=xxx.asp?param1=value1&param2=value2></script> 返回来的javascript代码段?
    对后一种,就可以传参数,服务器端处理你的ASP参数,返回你要的代码段。