first, the function return statement
Define the return value of the function, set the return value with return inside the function, and a function can have only one return value . also, terminate the execution of the Code.
All custom functions do not return a value by default
Don't break after Return.
var a=10,b=20,c=30;
++a;
a++;
e=++a+ (++b) + (c + +) +a++;
Alert (e);//77
second, get focus, Lose focus Event
Get focus:onfocus
Lost Focus:onblur
Case:
1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>$id function</title>6 <style>7 Div{8 Height:100px;9 width:100px;Ten Background-color:Pink; one } a </style> - <Script> - window.onload=function(){ the function $id (id) {document.getElementById return (id); + } - $id ("Demo1"). Style.backgroundcolor="Red"; + $id ("Demo2"). Style.backgroundcolor="Yellow"; - $id ("Demo3"). Style.backgroundcolor="Blue"; + a $id ("btn"). onclick=function(){ at if($id ("txt"). Value=="Deng"){ - Alert ("congratulations, the Jackpot."); - }Else{ - Alert ("no such person ."); - } - } in } - to </Script> + </Head> - <Body> the <DivID= "demo1"></Div> * <DivID= "demo2"></Div> $ <DivID= "demo3"></Div>Panax Notoginseng <inputtype= "text"ID= "txt"value= "please Enter ..."> - <ButtonID= "btn">Inquire</Button> the </Body> + </HTML>
Operating Effect:
Day 26th: js-$id function, Focus Event