<script type=”text/javascript”>
function clearDefaultText(el, message) {
var obj = el;
if (typeof(el) == “string”) obj = document.getElementById(id);
if (obj.value == message) {
obj.value = “”;
}
obj.onblur = function() {
if (obj.value == “”) {
obj.value = message;
}
}
}
</script>

<input type=”text” value=”验证码” onclick=”clearDefaultText(this,\’验证码\’)” />

 

版权声明:本文为txhy原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/txhy/p/4941821.html