|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: |
// Read the name, id, type, and value of one form control element
// as requested by form2ArrayString( )
function formObj2String(obj) {
var output = "{";
if (obj.name) {
output += "name:'" + obj.name + "',";
}
if (obj.id) {
output += "id:'" + obj.id + "',";
}
output += "type:'" + obj.type + "',";
switch (obj.type) {
case "radio":
if (obj.name) {
obj = document.forms[0].elements[obj.name];
var radioVal = "value:false,index:-1";
for (var i = 0; i < obj.length; i++) {
if (obj[i].checked) {
radioVal = "value:true,index:" + i;
i = obj.length;
}
}
output += radioVal;
} else {
output += "value:" + obj.checked;
}
break;
case "checkbox":
output += "value:" + obj.checked;
break;
case "select-one":
output += "value:" + obj.selectedIndex;
break;
case "select-multiple":
output += "value:" + obj.selectedIndex;
break;
case "text":
output += "value:'" + escape(obj.value) + "'";
break;
case "textarea":
output += "value:'" + escape(obj.value) + "'";
break;
case "password":
output += "value:'" + escape(obj.value) + "'";
break;
case "hidden":
output += "value:'" + escape(obj.value) + "'";
break;
default:
output += "";
}
output += "}"
return output;
}
// Convert a passed form reference to a string formatted like
// a JavaScript array of objects
function form2ArrayString(form) {
var elem, lastName = "";
var output = "[";
for (var i = 0; i < form.elements.length; i++) {
elem = form.elements[i];
if (elem.name && (elem.name != lastName)) {
output += formObj2String(form.elements[i]) + ",";
lastName = elem.name;
}
}
output = output.substring(0, output.length-1) + "]";
return output;
}
// Distribute form control values from another source to the
// controls in this page's form, whose names/ids match those
// of the original form controls
function string2FormObj(form, str) {
var elem, objArray = eval(str);
for (var i = 0; i < objArray.length; i++) {
elem =( objArray[i].name) ?form.elements[objArray[i].name]:
document.getElementById(objArray[i].id);
switch (objArray[i].type) {
case "radio":
if (objArray[i].name && objArray[i].value && objArray[i].index >= 0) {
elem = elem[objArray[i].index];
}
elem.checked = objArray[i].value;
break;
case "checkbox":
elem.checked = objArray[i].value;
break;
case "select-one":
elem.selectedIndex = objArray[i].value;
break;
case "select-multiple":
elem.selectedIndex = objArray[i].value;
break;
default:
elem.value = unescape(objArray[i].value);
}
}
}
|
Advertisement
| Hall of Fame |
There are currently no qualifying experts in DOM
There are currently no qualifying experts in DOM