最简单方法:
打开b.htm时带参数,根据参数设定iframe src

解决方案 »

  1.   

    可以这样!
    a.htm代码:
    <a href=b.htm?ifrm=1.htm>Click to open 1.htm in Iframe</a><br>
    <a href=b.htm?ifrm=2.htm>Click to open 2.htm in Iframe</a><br>
    <a href=b.htm?ifrm=3.htm>Click to open 3.htm in Iframe</a>b.htm代码:
    <iframe id=ifrmid></iframe>
    <script>
    function QueryString(sName)
    {
        var sSource = String(window.document.location);
        var sReturn = "";
        var sQUS = "?";
        var sAMP = "&";
        var sEQ = "=";
        var iPos;
        iPos = sSource.indexOf(sQUS);
        var strQuery = sSource.substr(iPos, sSource.length - iPos);
        var strLCQuery = strQuery.toLowerCase();
        var strLCName = sName.toLowerCase();
        iPos = strLCQuery.indexOf(sQUS + strLCName + sEQ);
        if (iPos == -1)
        {iPos = strLCQuery.indexOf(sAMP + strLCName + sEQ);if (iPos == -1) return "";}
        sReturn = strQuery.substr(iPos + sName.length + 2,strQuery.length-(iPos + sName.length + 2));
        var iPosAMP = sReturn.indexOf(sAMP);
        if (iPosAMP == -1)
            return sReturn;
        else
           {sReturn = sReturn.substr(0, iPosAMP);}
    return sReturn;
    }
    ifrmid.location=QueryString('ifrm');
    </script>0~3.htm代码随意!这里,b.htm借用了孟子斑竹网页上找到的,普通HTML模拟ASP的QUERYSTRING传递参数!
    我觉得这西西非常非常非常好!
      

  2.   

    还有没有别的办法?比如
    window.location
    什么的?
    直接修改window.open打开的b.htm里面iframe的location?
    具体是否可以实现及其语法代码请大虾告知,谢谢
      

  3.   

    window.open()打开的?
    你可以用opener来取得a.htm里面的参数,再修改b.htm里面iframe的location.
    这样简单多了.
      

  4.   

    a.htm代码:
    <input type=text id=inputid><input value=Open type=button onclick=openw()>
    <script>
    function openw()
    {window.open('b.htm','newone');}
    </script>b.htm代码:
    <iframe id=ifrm></iframe>
    <script>
    ifrm.location=window.opener.inputid.value;
    </script>思路就是这样,你自己再根据自己的情况修改修改就可以了!
      

  5.   

    to:Estyle(靳田) 
    b.htm 里面的iframe.location取决于点击的哪个连接阿~~b.htm里面又如何判断点的哪个连接呢?