gpt4 book ai didi

Javascript 更改 iFrame 中的文本框值

转载 作者:行者123 更新时间:2023-11-30 08:54:54 25 4
gpt4 key购买 nike

我正在尝试更改 iframe 中文本框的值。 我已尝试以我能找到的所有方式使用 GetElementById,但似乎没有任何效果。

我通过使用对象数据标签找到了 iframe 的替代品,但它有同样的问题。

我的代码或多或少,为了演示我做了一些改动:

 <html>
<head>

<title>None</title>

</head>
<body>

<script type="text/javascript">

function changeValue() {
var textBox = document.getElementById('userName');
textBox = "hello!";

}

</script>

<iframe id="myFrame" src="http://www.website.com"></iframe>

<input type="button" onclick="changeValue()" value="Submit">

</body>
</html>

最佳答案

出于安全原因,这是不可能的。

如果您有访问权限,您将能够在您网站的 iframe 中加载 facebook.com 并使用 JavaScript 提取用户详细信息。

关于Javascript 更改 iFrame 中的文本框值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14379537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com