使用HTML技术,没有服务器页面。在Frame框架中,左右两个页面,左边页面超连接到右边显示。现在想通过左边的连接向右边页面传递参数。那么右边如何才能取到?(通过window.location.href分析不行了,框架页面取不到超连接的地址)

解决方案 »

  1.   


    function param(name) {
    var reg = new RegExp('&?' + name + "=([^&#]*)", "ig");
    var res = [];
    location.search.replace(reg, function($, $1) {
    res.push(decodeURIComponent($1));
    });
    // return res.join(", "); // 返回字符串
    return res; // 考虑到可能存在同名参数,返回值为 数组
    }
    alert(param('plugin'));
      

  2.   

    非常感谢楼上的回答,测试通过。通过URL分析参数的函数写过了,刚才一直不知道如何获取Frame地址,使用document.URL也能取到地址再分析的,不过感觉楼上写的好多了