Archive for May 18th, 2008

Javascript

Sunday, May 18th, 2008

Change an element’s parent

ewParent.appendChild(el);

Clear the document selection

function clearSelection() {
   var sel ;
   if(document.selection && document.selection.empty){
     document.selection.empty() ;
   } else if(window.getSelection) {
     sel=window.getSelection();
     if(sel && sel.removeAllRanges)
       sel.removeAllRanges() ;
   }
}