主页 M

javascript实现页面刷新时自动清空表单并选中的代码示例

2015-07-19 网页编程网 网页编程网

javascript实现页面刷新时自动清空表单并选中的方法,涉及javascript中reset与focus方法的相关使用技巧。

<script language="javascript">
window.onload=function() {
  document.forms[0].reset();
  placeFocus();
}
function placeFocus() {
  document.forms[0].elements[0].focus();
  // assuming the first element
}
</script>
阅读原文
阅读 4168
123 显示电脑版