62,046
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
<title>onfocus</title>
<script type="text/javascript">
window.onload = function (){
var txt = document.getElementById("TextBox1");
txt.onfocus = function (){
txt.value = '';
txt.select();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="d1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
<input type="text" name="textfield" id="textfield" size="20" value="测试字符" onmouseover="if(this.value=='测试字符')this.value=''" onmouseout="if(this.value=='')this.value='测试字符'" style="color:#a5a5a5"/>
<input type="text" name="key" id="key" class="input" value="请输入关键词" size="40" onFocus="this.value=''" >
<input type="image" name="imageField" id="imageField" src="images/btn_scarch.gif" align="middle" onClick="if(key.value=='请输入关键词'){key.value=''}"/>