【问题标题】:How to Input Domain and Then Use Info in an iFrame on Same or New Page如何输入域,然后在同一页面或新页面的 iFrame 中使用信息
【发布时间】:2014-09-03 14:02:42
【问题描述】:

我希望能够允许用户输入他们的网址,然后在 iframe 中使用该地址。

地址会放在这里:

<iframe src="http://blahblahblah/blah/?blah=WEB_ADDRESS_FROM_USER_INPUT/&x=63&y=36" id="my-iframe" scrolling="no"></iframe>

我试过到处寻找答案,但我没有运气。

感谢您为这个新手提供的任何帮助。

【问题讨论】:

    标签: javascript iframe submit-button


    【解决方案1】:

    我开发了大约六年^^。这是我的代码:

    <html>
    <head>
    <script type="text/javascript">
     function aendereInhalt()
     {
      var adresse1;
      adresse1 = prompt("Bitte geben sie die Adresse ein");
      if (adresse1 != null && adresse1 != "")
      {
        if (adresse1.indexOf("http:\/\/") == -1)
        {
            adresse1 = "http:\/\/" + adresse1;
            //this is nessecary, because in IE it does not work without protocol
        }
        document.getElementById("myIframe1").src =  adresse1;
      }
     }
    </script>
    <body>
        <iframe src="" id="myIframe1" style="width: 50%; height: 99%;"></iframe>
        <a href="" onClick="aendereInhalt(); return false;">Display content</a>
    </body>
    </html>
    

    示例会打开一个提示输入字段,以便用户输入 URL。

    【讨论】:

      猜你喜欢
      • 2021-01-23
      • 2013-10-09
      • 1970-01-01
      • 2018-04-29
      • 2016-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多