文本框内显示文本提示,当点击后提示消失!
实现代码:
[xhtml] view plain
copy
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<title>test</title>  
<script type="text/javascript"><!--  
var account_tip = "描述";  
//鼠标进入文本时间  
function init_value() {  
var bs = document.getElementById("Txt_remark");  
if (bs.value.length == 0 || bs.value == account_tip) {  
bs.value = "";  
}  
}  
//鼠标移出  
function init_over() {  
var bs = document.getElementById("Txt_remark");  
if (bs.value.length == 0 || bs.value == account_tip) {  
bs.value = account_tip;  
}  
}  
// --></script>  
</head>  
<body>  
<input ID="Txt_remark" value="描述" onfocus="init_value()" onblur="init_over()" />  
</body>  
</html>