autodist/webbuild/html/scripts/webbuild.js

47 lines
1.2 KiB
JavaScript

function getCheckedValuesByName(checkboxname) {
var e=document.getElementsByName(checkboxname);
var p="";
for (var j=0;j<e.length;j++) {
if (e[j].checked) p+=e[j].value+" ";
};
return p;
}
function checkAllBoxes(checkboxname,checked) {
var e=document.getElementsByName(checkboxname);
for (var j=0;j<e.length;j++) {
e[j].checked=checked;
};
}
function getSelectedValueById(selectname,idx) {
if (idx == undefined) idx = 0;
var i=document.getElementById(selectname).selectedIndex;
return document.getElementById(selectname).options[i+idx].value;
}
function checkEnter(event) {
event=event || window.event;
getEvent=event.keyCode;
if (getEvent == "13") {
return true;
}
return false;
}
function replaceHTML(el, html) {
var oldEl = typeof el === "string" ? document.getElementById(el) : el;
/*@cc_on // Pure innerHTML is slightly faster in IE
oldEl.innerHTML = html;
return oldEl;
@*/
var newEl = oldEl.cloneNode(false);
newEl.innerHTML = html;
oldEl.parentNode.replaceChild(newEl, oldEl);
/* Since we just removed the old element from the DOM, return a reference
to the new element, which can be used to restore variable references. */
return newEl;
};