利用js实现frameset框架传值,动态控制frame重定向

时间:2022-12-04 13:37:19

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>OA帮助首页</title>
    <script language="javascript">

//写了一个Request["Parms"]获取参数小脚本,关键一
var Request = new Array();

function InitData()
{
  var s = window.location.href;
  var n = s.indexOf("?");
  if (n>=0)
 s = s.substring(n+1);

  var valuelist = s.split("&");
  for (var i=0; i < valuelist.length; i++)
  {
    var pair = valuelist[i].split("=");
    if (pair.length > 1)
    {
 Request[pair[0]] = pair[1];
    }
  }
}
function getID()
{
    InitData();
    parent.leftFrame.document.location.href="test.aspx?HelpID="+Request["HelpID"]+"&CategoryID="+Request["CategoryID"];//该语句为关键语句,大家注意了,关键二
  
}
</script>
</head>
    <frameset rows="85,*" frameborder="yes" border="0" framespacing="0" scrolling="NO">
        <frame src="UntitledFrame-3.html" name="topFrame" scrolling="yes" frameborder="yes" noresize>
        <frameset cols="350,*" border="0" frameborder="yes" framespacing="1" scrolling="NO"onLoad="getID()" >
            <frame src='UntitledFrame-4.html' name="leftFrame" scrolling="NO">
            <frame src="UntitledFrame-5.html" name="rightFrame" id="rightFrame">
        </frameset>
    </frameset><noframes></noframes> 
</html>