Javascript 如何输入域,然后在同一页或新页的iFrame中使用信息
我希望能够允许用户输入他们的web地址,然后在iframe中使用该地址 地址将放在这里:Javascript 如何输入域,然后在同一页或新页的iFrame中使用信息,javascript,iframe,submit-button,Javascript,Iframe,Submit Button,我希望能够允许用户输入他们的web地址,然后在iframe中使用该地址 地址将放在这里: <iframe src="http://blahblahblah/blah/?blah=WEB_ADDRESS_FROM_USER_INPUT/&x=63&y=36" id="my-iframe" scrolling="no"></iframe> 我到处都想找到答案,但我运气不好 感谢您为这个新手提供的任何帮助。我开发了大约六年^^。这是我的代码: <html
<iframe src="http://blahblahblah/blah/?blah=WEB_ADDRESS_FROM_USER_INPUT/&x=63&y=36" id="my-iframe" scrolling="no"></iframe>
我到处都想找到答案,但我运气不好
感谢您为这个新手提供的任何帮助。我开发了大约六年^^。这是我的代码:
<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