<HTML> <Head> <title>Day02_js</title> <Scripttype= "Text/javascript"language= "JavaScript"src= "Js/test1.js"></Script> </Head> <Body> <form> <H2>1.BOM Demo for Window</H2> <inputtype= "button"onclick= "testconfirm ()"value= "Confirm Test"/><BR/><BR/> <inputtype= "button"onclick= "Testpromp ()"value= "Promp test"/><BR/><BR/> <inputtype= "button"onclick= "Opentest ()"value= "Open Test"/><BR/><BR/> <inputtype= "button"onclick= "Closetest ()"value= "Close Test"/><BR/><BR/> <inputtype= "button"onclick= "Refreshtest ()"value= "Refresh Test"/><BR/><BR/> <input/><BR/><BR/> <inputtype= "button"onclick= "Navitest ()"value= "Console View information test"/><BR/><BR/> <inputtype= "button"onclick= "Timetest ()"value= "timing Start"/> <inputtype= "button"onclick= "Cleartime ()"value= "Timed End"/> <inputID= "I1"/><BR/><BR/> </form> </Body></HTML>
functiontestconfirm () {varf = window.confirm ("Are you sure this is the operation?") ");//OK add cancel popup parameter custom, return value for click OK =true, click Cancel =false;alert (f);//Print the returned boolean value}functionTestpromp () {varf = window.prompt ("Please enter user name", "Jay Chou");//prompt plus text plus OK plus cancel popup first parameter prompt, second parameter default valuealert (f);//NULL is returned when the value point in the Print input box is canceled}functionopentest () {//window.open ("http://www.baidu.com");//Open a new page varConfig = "toolbar=yes,width=500,height=300";//Toolbar Show Toolbarwindow.open ("http://www.baidu.com", "1", config)//parameter 1 is custom, otherwise you cannot open a new window according to the size of config}functionclosetest () {window.close (); //Close the current page}functionrefreshtest () {window.location.reload (); //page Refresh}functionnavitest () {vararr =NewArray (5); Console.dir (arr); //Console.dir () can display all properties and methods of an object in the console. //Console.log (window.navigator.appVersion); Will print out the information in the browser console. View the currently viewed version //Console.dir (window.navigator.appVersion);}varTimer//Window Timerfunctiontimetest () {Timer= Window.setinterval (' func () ', 100);}varCount = 0;functionfunc () {count++; document.getElementById ("I1"). value=count;}functionCleartime () {window.clearinterval (timer);}
JavaScript Learning Note Jsbom Seventh (original) Reference JS usage table