MDL-8062 Remove name attribute from <form> and related javascript code cleanup (tested with FF, IE, Konq and Opera)

This commit is contained in:
skodak 2007-01-06 19:22:58 +00:00
parent ee7f231d08
commit d2ce367fb9
38 changed files with 135 additions and 125 deletions

View file

@ -9,8 +9,10 @@ function popupchecker(msg) {
}
}
/*
function popUpProperties(inobj) {
op = window.open();
/// Legacy function
var op = window.open();
op.document.open('text/plain');
for (objprop in inobj) {
op.document.write(objprop + ' => ' + inobj[objprop] + '\n');
@ -19,6 +21,7 @@ function popUpProperties(inobj) {
}
function fillmessagebox(text) {
/// Legacy function
document.form.message.value = text;
}
@ -26,27 +29,34 @@ function copyrichtext(textname) {
/// Legacy stub for old editor - to be removed soon
return true;
}
*/
function checkall() {
void(d=document);
void(el=d.getElementsByTagName('INPUT'));
for(i=0;i<el.length;i++)
void(el[i].checked=1)
var el = document.getElementsByTagName('input');
for(var i=0; i<el.length; i++) {
if(el[i].type == 'checkbox') {
el[i].checked = true;
}
}
}
function checknone() {
void(d=document);
void(el=d.getElementsByTagName('INPUT'));
for(i=0;i<el.length;i++)
void(el[i].checked=0)
var el = document.getElementsByTagName('input');
for(var i=0; i<el.length; i++) {
if(el[i].type == 'checkbox') {
el[i].checked = false;
}
}
}
function lockoptions(form, master, subitems) {
function lockoptions(formid, master, subitems) {
// Subitems is an array of names of sub items.
// Optionally, each item in subitems may have a
// companion hidden item in the form with the
// same name but prefixed by "h".
if (eval("document."+form+"."+master+".checked")) {
var form = document.forms[formid];
if (eval("form."+master+".checked")) {
for (i=0; i<subitems.length; i++) {
unlockoption(form, subitems[i]);
}
@ -59,16 +69,16 @@ function lockoptions(form, master, subitems) {
}
function lockoption(form,item) {
eval("document."+form+"."+item+".disabled=true");/* IE thing */
if(document.forms[form].elements['h'+item]) {
eval("document."+form+".h"+item+".value=1");
eval("form."+item+".disabled=true");/* IE thing */
if(form.elements['h'+item]) {
eval("form.h"+item+".value=1");
}
}
function unlockoption(form,item) {
eval("document."+form+"."+item+".disabled=false");/* IE thing */
if(document.forms[form].elements['h'+item]) {
eval("document."+form+".h"+item+".value=0");
eval("form."+item+".disabled=false");/* IE thing */
if(form.elements['h'+item]) {
eval("form.h"+item+".value=0");
}
}
function lockoptionsall(formid) {
@ -139,7 +149,7 @@ function submitFormById(id) {
if(!theform) {
return false;
}
if(theform.tagName != 'FORM') {
if(theform.tagName != 'form') {
return false;
}
if(!theform.onsubmit || theform.onsubmit()) {
@ -148,7 +158,7 @@ function submitFormById(id) {
}
function select_all_in(elTagName, elClass, elId) {
var inputs = document.getElementsByTagName('INPUT');
var inputs = document.getElementsByTagName('input');
inputs = filterByParent(inputs, function(el) {return findParentNode(el, elTagName, elClass, elId);});
for(var i = 0; i < inputs.length; ++i) {
if(inputs[i].type == 'checkbox' || inputs[i].type == 'radio') {