谁能告诉我电脑怎么实现定时自动打开某个网页,然后自动点击网页中的一个按钮?

JavaScript013

谁能告诉我电脑怎么实现定时自动打开某个网页,然后自动点击网页中的一个按钮?,第1张

如果你会js的话建议使用 chrome插件 web-terminal  这个插件可以定义一些定时任务去指定网页执行一段js代码

使用方法:

安装插件

在任何一个网页连续按2下ctrl键 就能打开web-terminal

然后输入 js `console.log(123)` -u http://www.baidu.com 这样就能打开百度网页

如何设置定时执行这段代码呢,可以使用cron命令

cron `00 50 22 * * *` "js `console.log(123)` -u http://www.baidu.com" -a

此任务代表每天的22:50 分执行这段js代码 也就是定时打开百度网页了

<script>

window.location.href="新页地址"  //将本页替换成新页面

window.open("新页地址")  //弹出一个新页面

</script>

改一下触发事件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />

<title>打开指定URL的窗口/改变链接时候状态栏的文字</title>

<script language="javascript">

/*申明一个代表窗体对象的变量,这是关键,他作为全局变量,后面两个函数都可以访问他

不赋值,也表示该值为null ,在if的时候就是false */

var Wind

function newWindow(url)

{//这里申明一个根据传来的地址打开新窗口的函数

Wind=window.open(url,"","width=400,height=300")//将打开的窗口对象作为值赋给Wind对象,括号里意思(地址,长宽)

}

function closeWind()

{//关闭打开的新窗口,否则提示

if(Wind)//如果Wind对象存在

{

Wind.close()//调用关闭方法

Wind=null//并把值赋成null

}

else

{//否则,也就是

alert("窗口早已关闭")

}

}

</script>

</head>

<body>

<p>

<input type="submit" name="tijiao" value="打开百度" onclick="newWindow('http://www.baid.com')" />

</p>

<p>

<input type="submit" name="close" value="关闭刚才打开的窗口" onclick="closeWind()" />

</p>

</body>

</html>