这里介绍两个属于表单的方法:
- 表单自动获得焦点—XX.focus();
鼠标经过表单时,自动选择表单内容—XX.select();
<script type="text/javascript"> window.onload = function () { var txt = document.getElementById("txt"); var sel = document.getElementById("sel"); //表单自动获得焦点 txt.focus(); //鼠标经过表单自动选择表单内容 sel.onmouseover = function () { sel.select(); } } </script>