表单事件
onfocus
获得焦点事件
<body>
<form action="">
<p>用户名<input type="text" id="ipt"></p>
<p>密--码<input type="password" id="psw"></p>
<p><input type="submit" id="st"></p>
</form>
</body>
<script>
iptobj= document.getElementById('ipt');
iptobj.onfocus =function(){
this.style.outlineColor='#f00';
this.value='';
}
</script>
onblur
失去焦点
onchange
onselect
onsumit
事件方法
select()
选中方法
<form action="">
<p>用户名<input type="text" id="ipt"></p>
<p>密--码<input type="password" id="psw"></p>
<p><input type="submit" id="st"></p>
</form>
</body>
<script>
iptobj= document.getElementById('ipt');
iptobj.onfocus =function(){
this.style.outlineColor='#f00';
this.value='';
this.select();
//选中方法
}
</script>
blur()
focus()
click()
submit()
reset()