onfocus():鼠标点在onfocus所在的标签上面时
onblur():鼠标点在除onfocus所在标签的其他地方
form表单的的提交方式:
使用超链接提交;
先获取form标签,使用form的submit属性:
<html>
<head>
</head>
<body>
<form id="form1">
<input type="text" name="username"><br/>
<input type="button" value="tijiao" οnclick="add1();">
</form></hr>
<input type="text" id="id1" name="tex" value="please input" οnfοcus="focus1();" οnblur="blur1();"><br/>
<a href="人人网注册.html?username=pcl">使用超链接提交</a>
</body>
<script type="text/javascript">
function add1(){
var form1=document.getElementById("form1");
form1.action="new 1.html";
form1.submit();
}
function focus1(){
var inp=document.getElementById("id1");
inp.value="";
}
function blur1(){
var inp=document.getElementById("id1");
inp.value="please input";
}
</script>
</html>