<div>
<input type="hidden" id="personId" name="personId[]" value="0" />
<span>乘机人姓名:</span>
<input type="text" id="passgenerName" name="passgenerName[]" /><font color="red">(必填)</font>
<span>证件类型:</span>
<select id="certifyType" name="certifyType[]">
<option value="0" selected>身份证</option>
<option value="1">士兵证</option>
<option value="2">军官证</option>
</select><font color="red">(必填)</font>
<span>证件号码:</span>
<input type="text" id="certifyNo" name="certifyNo[]" onblur="javascript:return authDocument(this);" /><font color="red">(必填)</font>
<span>类型:</span>
<select id="personType" name="personType[]">
<option value="1" selected>成人</option>
<option value="2">儿童</option>
</select><font color="red">(必填)</font>
<span>购买保险:</span>
<select id="Insure" name="Insure[]">
<option value="0">0</option>
<option value="1" selected>1</option>
</select>(20元)/份<font color="red">(必填)</font><br/>
<span>生日:</span>
<input type="text" id="birthday" name="birthday[]" /><br/>
</div>当证件号码的文本框失去焦点时,怎样获取到同级的证件类型的值?请高人帮忙看看!
但是主要要排除文本节点 。
function authDocument(obj){
var id = obj.id, tid = "certifyType"+id.substring("certifyNo".length);
var ctype = document.getElementById(tid);
alert(ctype.value);
return ctype.value;
}用ID做手脚吧,同级别的证件号码ID和证件类型ID后面的数字做成一样的就可以了.