JavaScript实现节点的删除与序号重建实例

标签:活动介绍    日期:2018-06-29 09:25    录入:美娱国际平台注册    浏览:

  

                                                  
1JS+CSS????
2JavaScript??б?С?
3 JavaScript??,?????
  var delAndReorder=function(root,rowTag,delTag,delClass,idTag){  var doc=document,  list=doc.getElementById(root || 'reroder-list');  if(!list){  return false;  }  var stopEvent=function(evt){  stopPropagation(evt);  preventDefault(evt);  },  stopPropagation=function(evt){  if (evt.stopPropagation) {  evt.stopPropagation();  }  else {  evt.cancelBubble=true;  }  },  preventDefault=function(evt){  if (evt.preventDefault) {  evt.preventDefault();  }  else {  evt.returnValue=false;  }  },  hasClass=function(elem, className){  var has=new RegExp("(?:^|\\s+)" + className + "(?:\\s+|$)");  return has.test(elem.className);  },  byClass=function(tag,className,root){  var elems=[],  tempEl=root.getElementsByTagName(tag),  i,  len=tempEl.length;  for (i=0; i < len; ++i) {  if (hasClass(tempEl[i],美娱国际注册 className)) {  elems.push(tempEl[i]);  }  }  if (elems.length < 1) {  return false;  }  else {  return elems;  }  },  firstTds=[],  rows=list.getElementsByTagName(rowTag || 'tr'),  delBtns=byClass((delTag || 'a'), (delClass || 'lnk-del'), list),  i=0,  len=rows.length,  reorder=function(idx){  var i=idx, len=firstTds.length;  if(idx!==(len-1)){  for(;i
★★★小编:美娱国际 整理文章,欢迎大家转载 ★★★
相关文章阅读