html:form标签的focus属性的作用
你可以用focus属性来生成JavaScript,它会“定焦”(focus)到该form所包含的一个元素上。使用focus属性时你需要给它指定元素的名称。比如,以下代码是定焦在第二个Text元素上的:
<body> <html:form action="/login" focus="password"> User Name: <html:text property="userName"/> <br>Password: <html:text property="password"/> <br><html:submit/> </html:form> </body>
该段代码会被转换成:
<body> <form name="loginForm" method="post" action="/myStrutsApp6/login.do"> User Name: <input type="text" name="userName" value=""> <br>Password: <input type="text" name="password" value=""> <br><input type="submit" value="Submit"> </form> <script language="JavaScript" type="text/javascript"> <!-- if (document.forms["loginForm"].elements[ "password"].type != "hidden") document.forms["loginForm"].elements[ "password"].focus() // --> </script> </body>
相关推荐
Qc 2020-07-19
swiftwwj 2020-07-05
wcqwcq 2020-07-04
TONIYH 2020-06-11
yhginny 2020-04-20
nicepainkiller 2020-05-12
苦咖啡flask 2020-05-09
xinjing0 2020-05-08
Lius 2020-05-05
ajaxtony 2020-05-04
bcbeer 2020-04-23
sicceer 2020-04-20
cmsmdn 2020-02-18
longshengguoji 2020-02-13
ajaxtony 2020-02-03
ELEMENTS爱乐小超 2020-01-17
waterv 2020-01-01