所以我有一个带有提交按钮的名字单选按钮。选择并提交单选按钮后,将显示所选名称的信息。我怎样才能做到这一点?
到目前为止,我有这个:
<script type="text/javascript">
<!--
var names_array = new Array();
names_array[0] = 'Amanda';
names_array[1] = 'Aivan';
names_array[2] = 'Yman';
names_array[3] = 'Tiffany';
names_array[4] = 'Hannah';
var phone_num = new Array();
phone_num[0] = '655-1512';
phone_num[1] = '546-4562';
phone_num[2] = '964-5645';
phone_num[3] = '687-5455';
phone_num[4] = '659-6548';
var address_array = new Array();
address_array[0] = '285 Parr Street';
address_array[1] = '345 Aberdeen Avenue';
address_array[2] = '589 Seymour Street';
address_array[3] = '1000 McPhillips Street ';
address_array[4] = '548 Alfred Street';
function openNewName()
{
var nm=prompt("Name");
var ph=prompt("Phone Number")
var add=prompt("Address")
}
function openNewNameInfo()
{
myWindow=window.open('','','width=300,height=150,top=200,left=500');
output(nm + ph + add);
}
function choosenItem()
{for(count=0;count<5;count++)
{if (MyForm.names[count].checked)
myWindow=window.open('','','width=300,height=150,top=200,left=500');
}
myWindow.document.write(?);
}
//-->
</script>
<form name="MyForm">
<input type="radio" name="names" value="Amanda">
<label>Amanda</label><br/><br/>
<input type="radio" name="names" value="Aivan">
<label>Aivan</label><br/><br/>
<input type="radio" name="names" value="Yman">
<label>Yman</label><br/><br/>
<input type="radio" name="names" value="Tiffany">
<label>Tiffany</label><br/><br/>
<input type="radio" name="names" value="Hannah">
<label>Hannah</label><br/><br/>
<input type="button" value="Show Info" onclick="choosenItem()"><br/>
</form>