<title></title>
<style type="text/css">
input
{
color:#808080;
}
</style>
<script type="text/javascript">
function gel(id) { return document.getElementById(id); }
window.onload = function () {
var input = document.getElementsByTagName("input");
for (var i = 0; i < input.length; i++) {
input[i].onfocus = function () {
for (var j = 0; j < input.length; j++) {
input[j].style.backgroundColor = "#fff";
input[j].value="请输入正确的内容"
}
this.value = "";
this.style.backgroundColor = "yellow";
}
}
}
</script>
</head>
<body>
<table>
<tr>
<td id="td1"><input type="text" value="请输入正确的内容"/></td>
<td id="td1"><input type="text" value="请输入正确的内容"/></td>
<td id="td1"><input type="text" value="请输入正确的内容"/></td>
</tr>
</table>
</body>
转载于:https://www.cnblogs.com/Aamir-Ye/archive/2013/01/22/2872246.html