View Single Post
Old 11-16-2012, 09:37 PM   PM User | #24
triko
New Coder

 
Join Date: Oct 2012
Location: Italy
Posts: 72
Thanks: 3
Thanked 0 Times in 0 Posts
triko is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
WOW! You know, you can *NOT* just make up your own language. You have to use the language AS IT EXISTS.
Code:
function day(myDay)
{
    var num = myDay;
    if ( document.getElementById("female").checked ) { num += 40; }
    alert( num );
}
CAUTION: This *ASSUMES* that if "female" is *NOT* checked, then "male* *IS* checked.

If you want to be careful about it:
Code:
function day(myDay)
{
    var num = "You did not check either radio button!";
    if ( document.getElementById("male").checked ) { num = myDay; }
    if ( document.getElementById("female").checked ) { num = myDay + 40; }
    alert( num );
}
Ok, sorry but I don't know how take to input checked!!! And it's so Easy, only add getElementById ("").checked Thanks so much my mentor Master javascript!
triko is offline   Reply With Quote