Setting javascript variables from html input field
This is more of a coding practice question, I want to set variables within
a javascript object / array from a html form.
I am currently doing this using the onkeyup and passing the value to a set
function. e.g: (along the lines of )
onclick="item.setVar('retouch', this.value); return false;"
setVar: function(variable, value){
this[variable] = parseInt(value);
}
is there a better way of doing this or is it down to personal preference.
I have re-written the code so I can specify which values to get and set.
No comments:
Post a Comment