<td><input id="warrantyStartDateStr" name="warrantyStartDateStr" class="toolbar_button_input_80" type="Text" onClick="WdatePicker()"></td> <td><input id="warrantyEndDateStr" name="warrantyEndDateStr" class="toolbar_button_input_80" type="Text" onClick="WdatePicker()" onBlur="checkDateOne(this)"></td>
function checkDateOne(inputsNode){
var p = inputsNode.parentNode; //取得input节点的父节点td
var preNode=p.previousSibling.firstChild;//取得td节点的前一个兄弟节点的第一个子结点
var startDate = document.getElementByIdx_x(preNode.id).value;
var endDate = document.getElementByIdx_x(inputsNode.id).value;
if(startDate.length>0 && endDate.length>0){
var startTmp=startDate.split("-");
var endTmp=endDate.split("-");
var sd=new Date(startTmp[0],startTmp[1],startTmp[2]);
var ed=new Date(endTmp[0],endTmp[1],endTmp[2]);
if(sd.getDate()>=ed.getDate()){
alert("起始日期不能大于结束日期");
//return false;
}
}
}
<body> <div> <input id= "a4" type= "button" onclick= "alert(this.nextSibling);" value= "d" /> <input id= "a5" type= "button" onclick= "alert(this.nextSibling);" value= "e" /> </div> </body>
//下一个兄弟节点
function nextSibling(node) {
var tempLast = node.parentNode.lastChild;
if (node == tempLast) return null;
var tempObj = node.nextSibling;
while (tempObj.nodeType != 1 && tempObj.nextSibling != null) {
tempObj = tempObj.nextSibling;
}
return (tempObj.nodeType==1)? tempObj:null;
}
//前一个兄弟节点
function prevSibling(node) {
var tempFirst = node.parentNode.firstChild;
if (node == tempFirst) return null;
var tempObj = node.previousSibling;
while (tempObj.nodeType != 1 && tempObj.previousSibling != null) {
tempObj = tempObj.previousSibling;
}
return (tempObj.nodeType==1)? tempObj:null;
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" language="javascript" >
window.onload = function () {
var oUl = document.getElementsByTagName("UL");
var nodeLi = oUl[0].childNodes[3];
var nextListItem = nodeLi.nextSibling;
var preListItem = nodeLi.previousSibling;
alert(nextListItem.tagName + " " + preListItem.tagName);
nextListItem = nextSibling(nodeLi);
preListItem = prevSibling(nodeLi);
alert(nextListItem.tagName + " " + preListItem.tagName);
}
//下一个兄弟节点
function nextSibling(node) {
var tempLast = node.parentNode.lastChild;
if (node == tempLast) return null;
var tempObj = node.nextSibling;
while (tempObj.nodeType != 1 && tempObj.nextSibling != null) {
tempObj = tempObj.nextSibling;
}
return (tempObj.nodeType==1)? tempObj:null;
}
//前一个兄弟节点
function prevSibling(node) {
var tempFirst = node.parentNode.firstChild;
if (node == tempFirst) return null;
var tempObj = node.previousSibling;
while (tempObj.nodeType != 1 && tempObj.previousSibling != null) {
tempObj = tempObj.previousSibling;
}
return (tempObj.nodeType==1)? tempObj:null;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>JQuery</li>
<li>Dom</li>
</ul>
<ul>
<li>ASP.NET</li>
<li>JSP</li>
<li>PHP</li>
<li>VB.NET</li>
</ul>
</div>
</form>
</body>
</html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有