怎么做 显示提示框 (不是 alert这种弹出来的) 要 显示出来的
没写值 直接按提交按扭
哪个框没写值的话 就在哪个框后面 显示 提示信息<table>
<tr>
<td><input type="text">姓名</td>
<td><input type="text">姓名为空的话 输出 姓名不能为空提示信息</td>
</tr>
<tr>
<td><input type="text">性别</td>
<td><input type="text">性别为空的话 输出 性别提示不能为空提示信息</td>
</tr>
<input type="submit" value="提交">列:
跟新浪的 差不多
http://vip.sina.com.cn/register/reg_vipmail.php
document.getElementById("aa").innerHTML="姓名不能为空";
比如:<input type="text" onblur="check(this,'name')"><div id="name" style="display:none;float:left;"></div>
<script language="javascript">
function check(obj,id){
if(obj.value==""){
var namediv = document.getElementById(id);
namediv.style.display="block";
namediv.innerHTML="姓名不能为空!";
obj.focus();
}
}
</script>
<tr>
<td> 姓名:<input type="text" id='uname'> </td>
<td> <input type="text" id='name1' name='name1'></td>
</tr>
<tr>
<td> 性别:<input type="text" id='sex'> </td>
<td> <input type="text" id='sex1'></td>
</tr>
</tr>
<td>
<input type="submit" value="提交" onclick="return check()">
</td>
</tr>
</table>
<script>
function check()
{
var uname = document.getElementById('uname').value; var sex = document.getElementById('sex').value; if(uname =='')
{
document.getElementById('name1').value ='姓名不能为空';
return false; }else if(sex =='')
{
document.getElementById('sex1').value ='性别不能为空';
return false;
}
}</script>