whenever i click on a radio button the value that comes out is NaN how to make it an integer

function MenuChange(){ 
newValue = parseInt(document.formcheck.Menu.value.asInt); 
document.formcheck.Price.value = newValue; 

<th>Menu </th><td>270/Head <input type="radio" name="Menu" onChange="MenuChange()" value='270'></td>
<td> </td>
<td>300/Head <input type="radio" name="Menu" onChange="MenuChange()" value='300'></td><td> </td>

Recommended Answers

All 4 Replies

Pass value of radio in the method


and then just assign value document.formcheck.Price.value to the passed value.

or if you want to get the value you can use like this.


how i don't get it

  • Try second option:-

instead of


try this


* Or there is another option:-

function MenuChange(value){ 
newValue = parseInt(value); 
document.formcheck.Price.value = newValue; 
<form name="formcheck">
<input type="radio" name="Menu" onChange="MenuChange(this.value)" value='270'>

it works tnx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.