I have the following. Based on which radio button is checked, I want to adjust the date that is filled in for the text box. The problem I am having is that each button fills in the same date. Am I misunderstandin g what getElementById( "opt1").val ue returns? TIA
[HTML]<html>
<head>
<script language="JavaS cript">
function changeRadioButt on(iDays)
{
if (document.getEl ementById("opt1 ").value == 'week')
{iDays = 7}
else
{iDays = 14 }
var myDate=new Date()
myDate.setDate( myDate.getDate( )+ iDays)
document.getEle mentById("dateB ox").value = myDate;
}
</script>
</head>
<body>
<input onclick="change RadioButton()" type="radio" name="priority" id="opt1" >week</input>
<input onclick="change RadioButton()" type="radio" name="priority" id="opt2" >month</input>
<input onclick="change RadioButton()" type="radio" name="priority" id="opt3" >year</input>
<input type="text" id="dateBox" value=""/>
</body>
</html>[/HTML]
[HTML]<html>
<head>
<script language="JavaS cript">
function changeRadioButt on(iDays)
{
if (document.getEl ementById("opt1 ").value == 'week')
{iDays = 7}
else
{iDays = 14 }
var myDate=new Date()
myDate.setDate( myDate.getDate( )+ iDays)
document.getEle mentById("dateB ox").value = myDate;
}
</script>
</head>
<body>
<input onclick="change RadioButton()" type="radio" name="priority" id="opt1" >week</input>
<input onclick="change RadioButton()" type="radio" name="priority" id="opt2" >month</input>
<input onclick="change RadioButton()" type="radio" name="priority" id="opt3" >year</input>
<input type="text" id="dateBox" value=""/>
</body>
</html>[/HTML]
Comment