This code function is to put values in a form which it gets from cookies.
I know it is far form perfect, but it shoud work.
the argument formName is the name of the form.
[code=php]
function returnFormCookies(formName){
var elem = document.getElementById(formName).elements; for (var i = 0; i < elem.length; i++) { if (elem[i].type != “button”) {
//its a button?
if (elem[i].name == “”) {
// i had no name
var c_name = elem[i].id; } else {
// i had a name
var c_name = elem[i].name; }
// If im a radio or check, the value checked is important to me
if (elem[i].type == “checkbox” || elem[i].type == “radio”) {
// apparently im a c-box or a radio”)
var checked = elem[i].checked; formName.elem[i].name.checked =getCookie(c_name) } else { var value = elem[i].value; formName.elem[i].name.Value=getCookie(c_name); } } else {
//I was i button, so dont bother to fill me
}
the code lines consisting of “formName.elem[i].<name/id>.<value/checked> =getCookie(c_name)” crash the script.
It generates this error: “formName.elem has no properties”
I i am asumming it sees the line as “formName.elem .[i]<name/id> .<value/checked>”
How to get it to work?