guvenck
07-05-2007, 09:35 PM
I would like to get the sum of three values which I collect from myForm. Unfortunately my code computes them as strings and not integers. How can I compute integer values?
var LeftcolumnWidth = myForm.leftcolumn_width.value; // 160
var MiddlecolumnWidth = myForm.middlecolumn_width.value; // 400
var RightcolumnWidth = myForm.rightcolumn_width.value; // 140
var MaintableWidth = LeftcolumnWidth + MiddlecolumnWidth + RightcolumnWidth; // should output 700 but
alert('Main table is '+MaintableWidth+'pixels wide'); // outputs 160400140
var LeftcolumnWidth = myForm.leftcolumn_width.value; // 160
var MiddlecolumnWidth = myForm.middlecolumn_width.value; // 400
var RightcolumnWidth = myForm.rightcolumn_width.value; // 140
var MaintableWidth = LeftcolumnWidth + MiddlecolumnWidth + RightcolumnWidth; // should output 700 but
alert('Main table is '+MaintableWidth+'pixels wide'); // outputs 160400140