急~!dreamweaver 的表单怎么设置必填项?!

来源:百度知道 编辑:UC知道 时间:2024/06/28 05:51:18
做了个表单 里面的姓名和电话要求必填 下面是我这个表单的代码
<label>*您的姓名:
<input name="iname" type="text"checked="checked">
</label>
</form>
<form id="form6" name="form6" method="post" action="">
<label>*您的电话:
<input name="textfield2" type="text"checked="checked" />
</label>
</form>
<form id="form7" name="form7" method="post" action="">
<label>
<input type="submit" name="Submit" value="提交"/>
</label>
</form> </td>
</tr>

<SCRIPT>
<!--
function trimqh(str)
{
var par=/^\s+/;
var strRes=str.replace(par,'');
par=/\s+$/;
strRes=strRes.replace(par,'');

return strRes;
}

function check(){
var name=document.frm_photo.name.value;

if (trimqh(name)==""){
alert("姓名不能为空!");
frm_photo.name.focus();
return false;
}

else
document.frm_photo.action="save.php";
document.frm_photo.submit();
}

function gotoSelfUrl()
{
frm_photo.method = "post";
frm_photo.submit();
}
-->
</SCRIPT>

<form method="post" name="frm_photo" style="margin:0px;">

<input type="text" name="name" id="name" />

<input name=&quo