zoukankan      html  css  js  c++  java
  • H50080:html url 地址获取id 嵌入iframe并动态传入id

    1,访问地址:

    https://www.xxx.com/xxx.html?id=bmRMH3GfST

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>空间</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <style>
            iframe {
                position: absolute;
                top: 0;
                bottom: 0;
                left: 0;
                right: 0;
                height: 100%;
                width: 100%;
            }
        </style>
    
    <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?4447de3b4a47f73e510bb33a690706eb";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
    // 获取url参数名
    function GetQueryString(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null){
            return unescape(r[2]);
     
        }else{
            return null;
        }
    }
    function cc(){
        document.getElementById('frameid').src="https://www.xxx/ys/player.html?id="+GetQueryString('id');
    }
    
    </script>
    
    </head>
    
    
    <body onload="cc()">
    <iframe name="son" id="frameid" src="" width="100%" height="100%" scrolling="no" frameborder="no"  security="restricted" sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts">
    </iframe>
    
    </body>
    </html>
    琥珀君的博客
  • 相关阅读:
    开启gpu加速的高性能移动端相框组件!
    一看就懂得移动端rem布局、rem如何换算
    加密算法
    YDNKJS 笔记
    JavaScript函数
    测试下
    console前端代码自动删除QQ空间我的说说
    前端规范
    解决方案
    重读js高程笔记二
  • 原文地址:https://www.cnblogs.com/eliteboy/p/15415404.html
Copyright © 2011-2022 走看看