Javascript 标签的验证?
我有四个标签在我的页面与他们相应的领域。。。 我希望如果选择了一个特定的选项卡,那么我只希望在javascript中验证该选项卡的字段Javascript 标签的验证?,javascript,Javascript,我有四个标签在我的页面与他们相应的领域。。。 我希望如果选择了一个特定的选项卡,那么我只希望在javascript中验证该选项卡的字段 <div class="tabcontents"> <div id="view1"> <table > <tr> <td width="293"><span style="color:red;font-we
<div class="tabcontents">
<div id="view1">
<table >
<tr>
<td width="293"><span style="color:red;font-weight:bold">**</span>Plan Name:</td><td colspan="3">
<input type="text" name="planName" id="planName" value=""/></td>
<td width="172"><span style="color:red;font-weight:bold">**</span>Price:</td><td width="262" colspan="3">
<input type="text" name="price" id="price" value=""/></td>
</tr>
<tr><td width="172"><span style="color:red;font-weight:bold">**</span>Billing Code:</td><td width="262" colspan="3">
<input type="text" name="billingCode" id="billingCode" value=""/></td></tr>
</table>
</div>
<div id="view2">
<table width="936">
<tr>
<td width="137">Group Id:</td><td colspan="3">
<input type="text" name="groupId" id="groupId" value=""/></td>
<td width="194">Group Primary CTN:</td><td width="263" colspan="3">
<input type="text" name="groupPrimaryCTN" id="groupPrimaryCTN" value=""/></td>
</tr>
</table>
</div>
**计划名称:
**价格:
**计费代码:
组Id:
集团主要CTN:
您可以在验证功能中检查您的条件
在submit方法上创建事件
function checkValidation()
{
var returnValue=false;
//make four different condition for all tabs ..like
if( document.getElementById("view1").style.display == "none" )
{
returnValue = validationForTab1();
} else if (document.getElementById("view2").style.display == "none")
{
returnValue = validationForTab2();
} else if (document.getElementById("view3").style.display == "none")
{
returnValue = validationForTab3();
} else if (document.getElementById("view4").style.display == "none")
{
returnValue = validationForTab4();
}
return returnValue ;
}
validationForTab1()
{
}
validationForTab2()
{
}
validationForTab3()
{
}
validationForTab4()
{
}
这是一个有点难的过程,但您可以很容易地编写它…现在我将如何检查相应字段是否为空??您可以在其验证方法中为选项卡的相应字段编写验证…对于验证过程,您可以在此处看到。。。