View Full Version : Calling a radio to a new page
Alright he is my problem...
I am trying to call the 1 that is pick to a new page..here is what i got but it is wrong
go.document.write(document.car.slow.value);
but when i add
go.document,write(document.car.limit.value);
Both lines show up on the new page... I am trying to have only one picked
Can some 1 help me?
<input type=radio name=slow value="I Drive Like A Grandma">I Drive Like A Grandma<br>
<input type=radio name=limit value="I Drive The Speed Limit">I Drive The Speed Limit<br>
<input type=radio name=five value="Around 5 mphs Over The Speed Limit">Around 5 mphs Over The Speed Limit<br>
<input type=radio name=ten value="Usually 10 mphs Over The Limit">Usually 10 mphs Over The Limit<br>
<input type=radio name=fifteen value="I Like To Cruise 15 mphs Over The Limit">I Like To Cruise 15 mphs Over The Limit<br>
<input type=radio name=twenty value="I Like To Fly 20 mphs Over">I Like To Fly 20 mphs Over<br>
<input type=radio name=fast value="As Fast As I Can Go!">As Fast As I Can Go!<br>
Not exactly sure what you are after but if you only want to be able to select one radio button they must all have the same name.
<input type=radio name="speed" value="I Drive Like A Grandma">I Drive Like A Grandma<br>
<input type=radio name="speed" value="I Drive The Speed Limit">I Drive The Speed Limit<br>
<input type=radio name="speed" value="Around 5 mphs Over The Speed Limit">Around 5 mphs Over The Speed Limit<br>
<input type=radio name="speed" n value="Usually 10 mphs Over The Limit">Usually 10 mphs Over The Limit<br>
<input type=radio name="speed" n value="I Like To Cruise 15 mphs Over The Limit">I Like To Cruise 15 mphs Over The Limit<br>
<input type=radio name="speed" value="I Like To Fly 20 mphs Over">I Like To Fly 20 mphs Over<br>
<input type=radio name="speed" value="As Fast As I Can Go!">As Fast As I Can Go!<br>
PS
Forgot this bit
Your statement line would then be
go.document,write(document.car.speed.value);
didn't notice the typo there
go.document.write(document.car.limit.value);
I'll get it right soon
Ignore the last two posts there was a error in both of them
go.document.write(document.car.speed.value);
i tried that and it shows all the ones that i enter... i am just looking for the one that is picked to go to the new page ...
i am trying call the one selected to the new page....
i am trying to call it to this page:
<script language="javascript">
function prompt()
{
var go=window.open("",'win1','width=800, height=800,menubar=no,status=no,location=no,toolbar=no');
go.document.write("<html><head><body>");
go.document.write("<title>Your Fanasty Car Is:</title></head>");
go.document.write("Your First Name Is: ");
go.document.write(document.car.first.value+"<br>");
go.document.write("Your Last Name Is: ");
go.document.write(document.car.last.value+"<br>");
go.document.write("Your Car Name Is: ");
go.document.write(document.car.carname.value+"<br>");
go.document.write("The City You Live In Is: ");
go.document.write(document.car.city.value+"<br>");
go.document.write("The State You Live In Is: ");
go.document.write(document.car.state.value+"<br>");
go.document.write("Your Zip Is: ");
go.document.write(document.car.zip.value+"<br>");
go.document.write("Your Country Is: ");
go.document.write(document.car.country.value+"<br>");
go.document.write("The Car You Picked Was: ");
go.document.write(document.car.pick.value +"<br>");
go.document.write("How do you drive: ");
go.document.write(document.car.slow.checked.value +"<br>");
go.document.write("</body></html>");
}
</script>
Try the following example:
Function whichradio() checks to see which radio button is selected and sets variable radio_data to its value.
<script language="javascript">
<!--
function whichradio(){ // check for a selected radio button
formfield=document.f1.rad // formname and input names to be checked
for(i=0;i<formfield.length;i++)
if (formfield[i].checked==true){ // identify selected radio button
radio_data=formfield[i].value // value of radio button selected
}
}
setTimeout("whichradio()",500)
function test(){
nw=window.open('','win1','width=200,height=200,left=250,top=100')
nw.document.write("<html><head><body>");
nw.document.write("<title>Radio Button Thing</title></head>");
nw.document.write("You prefer travelling in a <b>"+radio_data)
nw.document.write("</body></html>");
}
// -->
</script>
Please select your preferred mode of travel.
<P><form name=f1>
<input type=radio name=rad value="Car" onclick="whichradio()" checked>Car <BR>
<input type=radio name=rad value="Train" onclick="whichradio()">Train <BR>
<input type=radio name=rad value="Plane" onclick="whichradio()">Plane
<P><input type=button value="Press" onclick="test()">
</form>
beetle
09-05-2002, 05:55 PM
prompt() is an existing Javascript function. You should change that function's name.
Also, you need to add go.document.close(); at the end of all the write statments, to close the data stream to the new window so it will actually display.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.