try
---------------------------
document.frames["mainFrame"].src="home.asp?type=" + QueryString("type");ordocument.frames["mainFrame"].document.location="home.asp?type=" + QueryString("type");

解决方案 »

  1.   

    document.getElementById("mainFrame").location = "home.asp?type="+QueryString("type");
      

  2.   

    以上三种都试了,但都没效果,mainFrame的src还是空的?代码如下:
    <script> 
    function QueryString(item)
    {
      var sValue=location.search.match(new RegExp("[\?\&]"+item+"=([^\&]*)(\&?)","i")) 
      return sValue?sValue[1]:sValue 

    alert(QueryString("type"));
    </script> <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <frameset rows="100,*" cols="*" framespacing="1" frameborder="yes" border="0.1" bordercolor="#CCCCCC">
      <frame src="top.asp" name="topFrame" frameborder="no" scrolling="NO" noresize >
      <frameset rows="*" cols="180,*" framespacing="0" frameborder="no" border="0" bordercolor="#CCCCCC">
      <frame src="tree.asp" name="leftFrame" frameborder="no" border="0">
      <frame src="" name="mainFrame" frameborder="no" noresize>
      <script>
      document.frames["mainFrame"].document.location="home.asp?type=" + QueryString("type");
      </script>
      </frameset>
    </frameset></html>
      

  3.   

    try
    ----------------------------------------------
    <script language="javascript"> 
    function QueryString(item)
    {
      var sValue=location.search.match(new RegExp("[\?\&]"+item+"=([^\&]*)(\&?)","i")) 
      return sValue?sValue[1]:sValue 
    }
    window.onload=function(){
    document.frames["mainFrame"].document.location="home.asp?type=" + QueryString("type");
    }
    </script> 
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <frameset rows="100,*" frameborder="0">
    <frame name="topFrame" scrolling="no" noresize scrolling="no" src="top.asp">
    <frameset cols="180,*" frameborder="0">
    <frame name="leftFrame" target="mainFrame" src="tree.asp">
    <frame name="mainFrame" src="home.asp">
    </frameset>
    <noframes>
    <body>
    <p>此网页使用了框架,但您的浏览器不支持框架。</p> </body>
    </noframes>
    </frameset></html>
      

  4.   

    发现一个后续问题:我用html而不用ASP的本意是因为框架页如果用ASP,那么在任意子框架打开其他页面后点刷新按钮,都会回到框架页最初设置的页面,而html就不会。现在加了window.onload=function(){
    document.frames["mainFrame"].document.location="home.asp?type=" + QueryString("type");
    后,页面是定向过去了,单是前面所说的刷新的问题又回来了,这样的话我用html就没意义了leohuang(LEO)大哥,这个问题有办法解决吗?
      

  5.   

    你是不是想保留子框架的地址,刷新页面就是一切重新开始如果想保留子框架的地址可以放到Session或cookie里,这样刷新的时候就不会丢了
      

  6.   

    index.htm:
    <HTML><HEAD>
    <script>
     function setCookie(cookieName, cookieValue, expires, path, domain, secure) 
      {
    document.cookie =
    escape(cookieName) + '=' + escape(cookieValue)
    + (expires ? '; expires=' + expires.toGMTString() : '')
    + (path ? '; path=' + path : '')
    + (domain ? '; domain=' + domain : '')
    + (secure ? '; secure' : '');
    };function getCookie(cookieName) 
    {
    var cookieValue = '';
    var posName = document.cookie.indexOf(escape(cookieName) + '=');
    if (posName != -1) 
    {
    var posValue = posName + (escape(cookieName) + '=').length;
    var endPos = document.cookie.indexOf(';', posValue);
    if (endPos != -1) 
    {
    cookieValue = unescape(document.cookie.substring(posValue, endPos));
    }
    else 
    {
    cookieValue = unescape(document.cookie.substring(posValue));
    }
    }
    return (cookieValue);
    };
     function  clearCookie() 
    {
    var now = new Date();
    var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
    this.setCookie('wuxin', '', yesterday);
    this.setCookie('urlGo', '', yesterday);
    this.setCookie('message', '', yesterday);
    };// [Cookie] Returns ids of open nodes as a string</script>
    <SCRIPT FOR=window EVENT=close>
    clearCookie();
    </SCRIPT>
    <SCRIPT FOR=window EVENT=onload >
    if(getCookie("wuxin")==""){
    leftmenu.location="index.htm";
    }
    else{
    leftmenu.location=getCookie("urlGo");
    }
    </SCRIPT><TITLE></TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD><FRAMESET id=frame1 
    border=0 frameSpacing=0 rows=*,0 frameBorder=NO cols=*><FRAME 
    id=leftmenu src="index1.htm" 
    frameBorder=0   noResize>
    </FRAMESET></HTML>
    index1.htm:
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD><BODY>
    <form action="checkuser.htm" method="post">
    <input type="text" name="text" value="">
    <input type="submit" value="提交">
    </form>
    </BODY>
    </HTML>
    checkuser.htm:
    <HTML><HEAD><TITLE>IAMSS</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK 
    href="IAMSS.files/styles.css" type=text/css rel=stylesheet>
    <STYLE type=text/css>BODY {
    BACKGROUND-IMAGE: none
    }
    .style3 {
    FONT-WEIGHT: bold; COLOR: #ffffff; FONT-FAMILY: Verdana
    }
    </STYLE><SCRIPT>
    function setCookie(cookieName, cookieValue, expires, path, domain, secure) 
      {
    document.cookie =
    escape(cookieName) + '=' + escape(cookieValue)
    + (expires ? '; expires=' + expires.toGMTString() : '')
    + (path ? '; path=' + path : '')
    + (domain ? '; domain=' + domain : '')
    + (secure ? '; secure' : '');
    };
    function onload(cook,url){
    var wuxin
    var urlGo;
    if(url!=""){
    setCookie('wuxin',cook);
    setCookie('urlGo',url);
    top.leftmenu.location=url;
    }
    else{
    alert("错误");
    history.back();
    }
    }
    </SCRIPT><META content="MSHTML 6.00.2800.1106" name=GENERATOR>
    </HEAD><BODY onload="onload('123','main.htm')">
    </BODy></html>
      

  7.   

    是的,就是想保留子框架地址。单是我发现框架页如果用html的话,刷新后是可以保留当前打开的地址的,我不用asp就是因为这个。现在看来没有必要了。