①
//js gets the Table and changes its style
Cell 1 Cell 2
Cell 3 Cell 4 Cell 5
②
//The timed loop in js calls the function setInterval (infinite bomb) and the corresponding stop function
var timer //First, declare a variable to store setInterval and return
value.
timer=setInterval("alert('123')",500); //Use declared variables to store the value returned by setInterval.
clearInterval(timer); //Clear setInterval Function
If you really want to call parameters in the setInterval method, and the function needs to pass parameters, you can do it in the following way: declare the value to be passed as a global variable, and then
do it in the method Call. For example:
③
//js gets the URL of this page
var Url = window.location.href;
④
//js control to save this page
document.execCommand("SaveAs","","C:\index.htm") ; //1. The name of the operation to be performed, 2. The default save address, file name and file type
function save(dizhi){
document.execCommand("SaveAs","",dizhi);
}
⑤
//Open, save as, attribute, print" and other 14 JS codes
■Open■
■Save as■
classid=CLSID:8856F961 -340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0> ■Properties■
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0> ■Print■
classid=CLSID:8856F961-340A -11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0> ■Page Settings■
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0> ■Refresh■
■Import favorites■
■Export Favorites■
■Add to Favorites■
Folder>
■Organize Favorites■
■View original file■
■Language Settings■
■Forward■
■Back■
⑥
//Change CSS style
1. Partially change the style (case sensitive)
Change className (no need to add style)
document. getElementById('t2').className=”…”
Change classText (must add style)
document.getElementById(’t2’).style.cssText=”…”
Change the CSS of the control directly Style
document.getElementById('t2').style.backgroundColor=”#003366″
2. Globally change the style (skin change)
Add an id to the currently used CSS style and change the skin When changing the path of the referenced CSS style, for example:
Click me to change the style
⑦
//Generate random numbers , the parameters are (minimum value, maximum value)
function GetRnd(min,max){
return parseInt(Math.random()*(max-min 1));
}
⑧
//Convert strings to numbers in js
parseInt("123"); //123