hotti: getElementBy

Beitrag lesen

hi,

Wenn Du magst, kannste ja hier mal weiterschreiben

  
// Serialize  
function readForm(){  
	var params = new Array();  
	var inputfields = document.getElementsByTagName('input');  
	for(var i=0; i < inputfields.length; i++){  
		if(inputfields[i].type == 'text'){  
			params.push(inputfields[i].name + '=' + encodeURIComponent(inputfields[i].value));  
		}  
		else if( inputfields[i].type == 'radio' ){  
			if(inputfields[i].checked == true) params.push(inputfields[i].name + '=' + inputfields[i].value);  
		}  
		else if(inputfields[i].type == 'checkbox'){  
			if(inputfields[i].checked == true) params.push(inputfields[i].name + '=' + inputfields[i].value);  
		}  
	}  
	var textas = document.getElementsByTagName('textarea');  
	for(var i=0; i < textas.length; i++){  
		params.push(textas[i].name + '=' + encodeURIComponent(textas[i].innerHTML));  
	}  
	return params.join('&');  
}  

Da fehlen noch die Selects ;-)

Hotti