Sometimes you can write a webpage to execute some tasks, which are long-lived tasks. Javascript will automatically execute the steps. In normal times, I open the tasks directly and let them run them by myself, but sometimes it will stop with an error, but I don't know, it is a waste of waiting time, so I want to know how to notify me when I don't see that page. I went to the Internet to find JavaScript, and a function was available.
Window. Focus ();
This function, when you do not view it on this page, if Javascript triggers this event, it will flash the focus in the Windows taskbar, as if there is a message from QQ, it will flash in the taskbar.
By the way, write down the JavaScript code for automatically scheduled tasks. Some PHP code is contained in the middle.
<Script language = "JavaScript">
<! --
VaR go_next = true;
Function stop (){
Go_next = false;
}
// -->
</SCRIPT>
<A href = '? Page = <? = $ Page + 1?> '> Next page </a> <br> next page 2 seconds later
<Input type = "button" value = "stop" onclick = "Stop ()">
<Script language = "JavaScript">
<! --
<? If ($ oneok) {?>
SetTimeout ("next_page ()", 2000 );
<? }?>
Function next_page (){
If (go_next) location. href = "? Page = <? = $ Page + 1?> ";
}
// -->
</SCRIPT>