当输入框获得焦点时,清空value的值,用js文件的形式

<form action="submitpage.htm" onsubmit="return validate_form(this)" method="post">
Email: <input type="text" name="email" size="30" value="913581212@qq.com" >
<input type="submit" value="Submit">
</form>
为什么一定要放到JS文件中呢,这样会比较麻烦,但也不是不能.代码如下:
window.onload=function(){
document.getElementsByName('email')[0].onfocus=function(){
document.getElementsByName('email')[0].value='';
};
};
给你想清空内容的input绑定onfocus事件。
xxx.onfocus = function(){
this.value = '';
};
就可以了。