【发布时间】:2018-06-02 20:36:39
【问题描述】:
我想从另一个网站填写表格,但我有一个错误,我不明白为什么。
我的 JS 的功能:
<script type="text/javascript">
function rempliFormulair(url) {
var fenetrePopup = window.open(url);
fenetrePopup.getElementsByName("NameText").value = "MyLogin";
fenetrePopup.getElementsByName("NameForm").submit();
}
</script>
有我的表格:
<form name = "NameForm" class="" action="index.html" method="post">
<input id = "idText" type="text" name="NameText" value="">
<input id = "azee" type="submit" name="submit" value="aze">
</form>
我的错误:
未捕获的 TypeError: fenetrePopup.getElementsByName 不是 rempliFormulair 的函数
【问题讨论】:
-
试试
fenetrePopup.document.getElementsByName -
感谢您的回答,但没有比这更好的了:/
标签: javascript