First: Using JavaScript to implement
E:\GitHub\tools\JavaEEDevelop\Lesson4_JavaScript_Demo1\day02\part01\focus1.html
1 <!DOCTYPE HTML>2 <HTML>3 <HeadLang= "en">4 <MetaCharSet= "UTF-8">5 <title></title>6 </Head>7 <Body>8 <Table>9 <TR>Ten <TD>Books</TD> One <TD> A <inputtype= "text"name= "book"ID= "book" /> - </TD> - </TR> the <TR> - <TD>Price</TD> - <TD> - <inputtype= "text"name= "Price"ID= "Price" /> + </TD> - </TR> + </Table> A <Scripttype= "Text/javascript"> at document.getElementById (" Book"). focus (); - </Script> - </Body> - </HTML>
The second type: using the HTML5 property to implement
E:\GitHub\tools\JavaEEDevelop\Lesson4_JavaScript_Demo1\day02\part01\focus2.html
1 <!DOCTYPE HTML>2 <HTML>3 <HeadLang= "en">4 <MetaCharSet= "UTF-8">5 <title></title>6 </Head>7 <Body>8 <Table>9 <TR>Ten <TD>Books</TD> One <TD> A <inputtype= "text"name= "book"ID= "book" /> - </TD> - </TR> the <TR> - <TD>Price</TD> - <TD> - <inputtype= "text"name= "Price"ID= "Price"Autofocus/> + </TD> - </TR> + </Table> A </Body> at </HTML>
HTML page Default input focus two ways of setting