简体   繁体   English

你如何写 Javascript 打开页面,然后点击页面上的按钮 go

[英]How do you write Javascript to open page and then click on button on page in one go

I would like to open a particular webpage and then click on a button to open another page from that page.我想打开一个特定的网页,然后单击一个按钮从该页面打开另一个页面。 Now I can see how to write Javascript to find a button on page and click on it, what I dont quite understand how I can do that from the 1st page.现在我可以看到如何编写 Javascript 来在页面上找到一个按钮并单击它,我不太明白如何从第一页开始。

ie on Page 1 can open Page 2, but how do I in one go from page 1 get it to click on a button on page 2 once page 2 is loaded because until Page 2 is loaded the button is not available, and if I just go to Page 2 my Javascript will not be running because that was on Page 1?即在第 1 页上可以打开第 2 页,但是我如何在第 1 页的一个 go 中让它在第 2 页加载后单击第 2 页上的按钮,因为在加载第 2 页之前按钮不可用,如果我只是go 到第 2 页 我的 Javascript 不会运行,因为它在第 1 页?

What I am trying to do is a poweruser feature that makes it easier to do a particular repetitive task, I am the sys adminstator for page 1 but not page 2.我想做的是一个 poweruser 功能,它可以更轻松地执行特定的重复性任务,我是第 1 页而非第 2 页的系统管理员。

This is example of the page Im trying to do this for这是我尝试为此执行此操作的页面示例

https://acoustid.org/track/61c9656b-6838-4660-8113-86f7f90fd549 https://acoustid.org/track/61c9656b-6838-4660-8113-86f7f90fd549

You need to login to Acoustid to actually see the Disable buttons您需要登录 Acoustid 才能真正看到禁用按钮

Open new browser window with js (modal or tab)用js打开新浏览器window(模态或tab)

var newWindow = window.open("http://www.....com");

Add onload handler for new window and insert script (optionally)为新的 window 添加 onload 处理程序并插入脚本(可选)

newWindow.addEventListener("DOMContentLoaded", Func);

function Func()
{
    var script = newWindow.document.createElement("script");
    script.text = "alert('hello');";
    newWindow.document.body.appendChild(script);
}

Insert js code straightforwardly if you don't need to handle load不需要处理load的直接插入js代码

Func();

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

相关问题 如何单击按钮使用JavaScript转到某些页面? - how to click the button the go to some page with javascript? 如何使javascript(包括具有数组和返回值的函数)在单击按钮时在div中写入而无需转到另一页 - How do you make javascript(including function with array and return) write in div on button click without going to another page 如何打开一个新的 html 页面以及一键点击链接 - How to open a new html page and also a link at one button click 一键+ javascript打开一个窗口(aspx页) - open a window (aspx page) with one click + javascript 是否可以使用php或javascript打开页面并单击另一页面上的按钮 - Is it possible to open a page and click a button on another page using php or javascript JavaScript Bookmarklet; 单击按钮,重新加载页面,然后打开页面 - JavaScript Bookmarklet; click button, reload page, then open page 如何在 vue 3 中单击按钮打开一个新页面? - How to open a new page on button click in vue 3? 如何在按钮单击时打开一个 aspx 页面作为弹出窗口 - how to open an aspx page as popup on button click go 到页面并打开模态 javascript - go to page and open modal javascript 我如何让屏幕上的所有内容都变暗,除了你点击汉堡按钮的 sidenav 一个 - How do I make all content on screen go dark except the sidenav one you click on the burger button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM