详解HTML5表单新增属性
<script type="text/javascript"> function alertSelectionDirection() { var control = document.forms[0]['text']; var Direction = control.selectionDirection; alert(Direction); } </script> <form> <input type="text" name="text"> <input type="button" value="惦记我" onclick="alertSelectionDirection()" > </form> 15. 复选框的indeterminate属性 对于复选框来说,过去只有选取和与非选取状态,html5中,可以在js中对该元素使用indeterminate属性,以说明复选框“尚未明确选取”状态。 <script> var cb = document.getElementById("cb"); //将indeterminate的属性设置为true cb.indeterminate = true; </script> <input type="checkbox" indeterminate id="cb">indeterminate属性测试 16. image提交按钮的height属性与width属性 height:指定图片按钮中图片的高度; width:指定图片按钮中图片的宽度; <input type="image" src=http://www.jb51.net/html5/"img/2.png" width="23" height="23"> 17. textarea元素的maxlength属性与wrap属性 maxlength :使用整数值进行设定,用于限定textarea元素中可输入文字的个数。 wrap:可指定属性值为soft与hard.当属性为hard时,在没有用回车键而是文字超出一排规定范围而自动换行时,提交表单时会在换行处添加一个换行标志。 (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |