<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
<script type="text/javascript" language="javascript">
?? //得到焦點時觸發(fā)事件
?? function onFocusFun(element,elementValue){
???? if(element.value==elementValue){
???? element.style.color = "";
???? element.value = "";?
? }???
???
?? }
?? //離開輸入框時觸發(fā)事件
?? function onblurFun(element,elementValue){
??
?? if(element.value==''){
???? element.style.color = "#CCCCCC";
???? element.value = elementValue;
?? }
??
?? }
</script>
</head>
<body>
<input name="textfield" type="text" value="默認值" style="color: #CCCCCC" onFocus="onFocusFun(this,'默認值')" onblur="onblurFun(this,'默認值')"/>
</font>
</body>
</html>
posted on 2008-09-16 11:54
梓楓 閱讀(1500)
評論(0) 編輯 收藏 所屬分類:
html