<html>
<head>
<script>
function varClear() {
if(form.text1.value != '' ) {
form.text1.value = '';
form.text1.focus();
    }
}
</script>
</head>
<body>
<form id='form'>
<input type="text" id='text1' name="text1">
<input type="button" name="button" onclick="varClear(this);" value="清除">
</form>
</body>
</html>