Jump to content

javascript Object


simeonC

Recommended Posts

Just a question can i dynamically set javascript object key:value properties?

function insert_current() {
var customer_information = new Object(); //the object which my input form values will be held
a = document.getElementsByTagName("input"); // gather input tags here


/////////////////////////////////// loop through each to get the elements ("input") form name attribute as well as the value.
			for (i=0; a.length > i; i++){
                field = a[i].getAttribute("name");
                value = a[i].value;
                
                customer_information.field= value;//this doesn't work
                var x=document.getElementById("left");
                x.innerHTML = JSON.stringify(customer_information);
                }
				
				
///////////////////////////////////
				
	}
Link to comment
https://forums.phpfreaks.com/topic/284423-javascript-object/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.