JSP text鼠标点击内容清空

来源:百度知道 编辑:UC知道 时间:2024/06/22 09:14:13
用户名输入的text
鼠标点击TEXT TEXT的内容清空怎么写 有比较简洁的吗

你这个问题。。。
<input type="text" value="" onclick="javascript:this.value='';">

那是用JavaScript:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>测试清空</title>
<script type="text/javascript">
function clearText(obj) {
if(!obj) return;
if(!obj.value) return;
obj.value = "";
}
</script>
</head>
<body>
<h1>请输入用户名</h1>
<