文本框默认文字说明,获取焦点时消失。
<html>
<body>
<input type="text" name="randomText" id="randomText" value="说明信息" οnfοcus="fo(this)" οnblur="bl(this)"/>
</body>
<script>
var text = document.getElementById("randomText").value;
function fo(obj){
if(obj.value == text){
obj.value = "";
}
}
function bl(obj){
if(obj.value == ""){
obj.value = text;
}
}
</script>
</html>