Jump to content

User:Alexav8/util.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
topaz.util = {
getobj:function(id) {
  return document.getElementById ?
             document.getElementById(id) :
             document.all[id];
},
add:function(parent, tag, attr) {
  var el = document.createElement(tag);
  if (attr) {
    for (key in attr) {
      el[key] = attr[key];
    }
  }
  return parent.appendChild(el);
},
mousebtnmap:{
  ns:[null,1,3,2],
  ie:[null,1,2,null,3]
},
xmlhttpreq:function() {
  if (window.XMLHttpRequest) {
    xmlhttpobj = new XMLHttpRequest()
  } else {
    try {
      xmlhttpobj = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttpobj = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        xmlhttpobj = null;
      }
    }
  }
  return xmlhttpobj;
}
};