简体   繁体   English

在新标签页中打开网页并自动填写表单

[英]Open a webpage in new tab and feed the form automatically

I would like to open an external webpage when my page loads and would like to feed the details in the form in the external webpage automatically. 我想在页面加载时打开一个外部网页,并希望在外部网页中自动填写表单中的详细信息。

I know i can load the page with the onload() jquery inbuild function but i am not sure how to feed the external site form from my page with the details automatically. 我知道我可以使用onload()jQuery inbuild函数加载页面,但是我不确定如何自动从页面中提供详细信息的外部站点表单。

window.onload = function () {
    load();
};

function load() {
    window.open('http://www.google.com', '_blank');
    document.getElementById("name").value = "my name";
    document.getElementById("age").value = 28;
}
function load() {
    var newTab = window.open('http://www.google.com', '_blank');
    newTab.document.getElementById("name").value = "my name";
    newTab.document.getElementById("age").value = 28;
}

Assign your new window to a variable, and then you can refer it like I did! 将新窗口分配给变量,然后可以像我一样引用它!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM