【发布时间】:2016-10-11 20:28:30
【问题描述】:
您好,我想在跨域的 iframe 中自动填充数据。我有一个代码,但它不起作用。请帮帮我。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function autoFill() {
var f=fm.document.forms[0];
f.form-control.value='Zanne';
f.submit();
}
</script>
</head>
<body>
<div>
<button type="button" onclick="autoFill();">autoFill</button>
</div>
<iframe name="fm" id="fm" src="url.com" width="100%" height="100%"></iframe>
</body>
</html>
输入填充:
有办法做到这一点。
【问题讨论】:
-
nope.. 除非 iframe 中的文档在同一个域中,否则不会。谷歌跨源脚本。
-
没办法?
-
你在这里的“合法”用户案例是什么?
标签: javascript php jquery ajax iframe