1、首先打开chrome浏览器,点击菜单上的“设置”按钮。
/iknow-pic.cdn.bcebos.com/f31fbe096b63f6245621f0e08944ebf81b4ca3d1"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/f31fbe096b63f6245621f0e08944ebf81b4ca3d1?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/f31fbe096b63f6245621f0e08944ebf81b4ca3d1"/>
2、其次,鼠标拉到底部,点击底部的“高级”按钮。
/iknow-pic.cdn.bcebos.com/72f082025aafa40fac9c073ea564034f79f019ff"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/72f082025aafa40fac9c073ea564034f79f019ff?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/72f082025aafa40fac9c073ea564034f79f019ff"/>
3、接着,点击“网站设置”按钮。
/iknow-pic.cdn.bcebos.com/6c224f4a20a4462338b36c819622720e0df3d7dc"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/6c224f4a20a4462338b36c819622720e0df3d7dc?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/6c224f4a20a4462338b36c819622720e0df3d7dc"/>
4、从弹出的面板,再再点击“JavaScript”菜单。
/iknow-pic.cdn.bcebos.com/cefc1e178a82b901b3d40ad07d8da9773812efdd"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/cefc1e178a82b901b3d40ad07d8da9773812efdd?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/cefc1e178a82b901b3d40ad07d8da9773812efdd"/>
5、最后将“允许(推荐)”按钮打开,之后刷新页面即可生效。
/iknow-pic.cdn.bcebos.com/dcc451da81cb39db66b8aeb5de160924aa1830dd"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/dcc451da81cb39db66b8aeb5de160924aa1830dd?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/dcc451da81cb39db66b8aeb5de160924aa1830dd"/>
其实我们可以这样想:浏览器是单线程的,那么我们只要在暂停的地方做三秒其他的事情不就达到了暂停的效果吗。试试这个:
1. //js暂停函数
2. function Pause(obj,iMinSecond){
3.if (window.eventList==null) window.eventList=new Array()
4.var ind=-1
5.for (var i=0i<window.eventList.lengthi++){
6.if (window.eventList[i]==null) {
7. window.eventList[i]=obj
8. ind=i
9. break
10. }
11. }
12.if (ind==-1){
13.ind=window.eventList.length
14.window.eventList[ind]=obj
15.}
16. setTimeout("GoOn(" + ind + ")",iMinSecond)
17. }
18.
19. //js继续函数
20. function GoOn(ind){
21. var obj=window.eventList[ind]
22. window.eventList[ind]=null
23. if (obj.NextStep) obj.NextStep()
24. else obj()
25. }
//js暂停函数
function Pause(obj,iMinSecond){
if (window.eventList==null) window.eventList=new Array()
var ind=-1
for (var i=0i<window.eventList.lengthi++){
if (window.eventList[i]==null) {
window.eventList[i]=obj
ind=i
break
}
}
if (ind==-1){
ind=window.eventList.length
window.eventList[ind]=obj
}
setTimeout("GoOn(" + ind + ")",iMinSecond)
}
//js继续函数
function GoOn(ind){
var obj=window.eventList[ind]
window.eventList[ind]=null
if (obj.NextStep) obj.NextStep()
else obj()
}
使用方法很简单:
Java代码
1. function testJsStop(){
2. alert("1")
3. Pause(this,3000)
4. this.NextStep=function(){
5. alert("2")
6. }
7. }