zoukankan      html  css  js  c++  java
  • js获取iframe通过url传递的参数

    获取iframe的url路径:

      window.parent.document.getElementById("Ateon-SetParent-iframe").contentWindow.location.search;    //需要iframe的ID

    根据参数名称通过正则获取参数值

    function geturl(name) {
                var reg = new RegExp("[^?&]?" + encodeURI(name) + "=[^&]+");
                var arr = window.parent.document.getElementById("Ateon-SetParent-iframe").contentWindow.location.search.match(reg);
                if (arr != null) {
                    return decodeURI(arr[0].substring(arr[0].search("=") + 1));
                }
                return "";
            }
  • 相关阅读:
    如何为创建大量实例节省内存?
    4-5
    4-6
    4-4
    4-3
    4-2
    3-11
    4-1
    3-10
    3-8
  • 原文地址:https://www.cnblogs.com/kcjm/p/7060073.html
Copyright © 2011-2022 走看看