<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無(wú)標(biāo)題文檔</title>
<script type="text/javascript" language="javascript">
?? //得到焦點(diǎn)時(shí)觸發(fā)事件
?? function onFocusFun(element,elementValue){
???? if(element.value==elementValue){
???? element.style.color = "";
???? element.value = "";?
? }???
???
?? }
?? //離開(kāi)輸入框時(shí)觸發(fā)事件
?? function onblurFun(element,elementValue){
??
?? if(element.value==''){
???? element.style.color = "#CCCCCC";
???? element.value = elementValue;
?? }
??
?? }
</script>
</head>
<body>
<input name="textfield" type="text" value="默認(rèn)值" style="color: #CCCCCC" onFocus="onFocusFun(this,'默認(rèn)值')" onblur="onblurFun(this,'默認(rèn)值')"/>
</font>
</body>
</html>