Javascript

chrome console监控客服回复

背景 二半夜在某服务器网站提交了一个ticket,时间紧迫,我需要第一时间看到对方回复,但我又不想坐在电脑前面干等,如何破? 是不是可以写一个js脚本监控页面内容变动,然后通过某种方式叫醒我? 实现 chrome console里实现自动刷新页面 参考链接1里的方法可以做到了。 timeout=prompt("Set timeout (Second):"); count=0 current=location.href; // 获取当前的URL if(timeout>0) setTimeout('reload()',1000*timeout); else location.replace(current); // 时间间隔不大于0,仅刷新一次 function reload(){ setTimeout('reload()',1000*timeout); // timeout秒后执行reload函数,实现无限循环刷新 count++; console.log('每('+timeout+')秒自动刷新,刷新次数:'+count); fr4me='<frameset cols=\'*\'>\n<frame src=\''+current+'\'/>'; fr4me+='</fr...

js创建新元素的几种方式

介绍 为了总结几种新建并插入dom元素到页面某部分的的方式,我们先搭建如下html结构。新建一个html文件,写入如下代码用chrome打开即可。 <!doctype html> <html lang="zh"> <head> <title>测试页面</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <div class="dropdown-menu" id="attributes_list"></div> <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> </body> </html> 有了这个html页面,我们就可以去chrome的debug console测试我们的j...
执行时间: 1713621533198.6 毫秒