You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
396 B

  1. function hasClass(el, cls) {
  2. return el.className && new RegExp("(\\s|^)" + cls + "(\\s|$)").test(el.className);
  3. }
  4. function removeClass(ele,cls) {
  5. if (hasClass(ele,cls)) {
  6. var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
  7. ele.className=ele.className.replace(reg,' ');
  8. }
  9. }
  10. function removeId(id) {
  11. return (elem=document.getElementById(id)).parentNode.removeChild(elem);
  12. }