
February 6th, 2002, 09:25 PM
|
 |
a lazy guy
|
|
Join Date: Aug 2001
Location: Hong Kong
Posts: 99
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
Javascript: String <-> Integer
Hello,
I got a problem with the following codes:
<html>
<script>
function cal(myForm)
{
var age = myForm.MyAge.options[myForm.MyAge.selectedIndex].value;
var myNum = age + 1;
alert(myNum);
}
</script>
<form name="myForm">
<select name="MyAge" onChange="cal(this.form)">
<option value="1">1</option>
<option value="2">2</option>
</select>
</form>
</html>
it prints '11' or '21', but not summing up the value.
anyone got a solution?
thanks.,
|