Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6785953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:11:18+00:00 2026-05-26T17:11:18+00:00

So i have this code: <html> <head> <title>Form</title> <script type=text/javascript> function showConfirmationDialog() { var

  • 0

So i have this code:

<html>
<head>
<title>Form</title>
<script type="text/javascript">
function showConfirmationDialog() {
    var textbox = document.getElementById('textbox');
    var location = document.getElementById('location');
    alert('You chosen:'+'\n'+'\n'+'Name: '+textbox.value +'\n'+'Address: ' +location.value+'\n');
}

function formfocus()  {
    document.getElementById('textbox').focus();
}
window.onload = formfocus;
var option; 
</script>   
</head>
<body>

Your name: 
<input type="text" name="FirstName" id="textbox" <br><br/> 

Your Address:
<input type="text" name="address" id="location" <br></br><br></br>

Choose your location:

<form name="Radio" id="destination" action="">

Bristol: 

<input type="radio" name="selection" value="bristol" onClick="option=0">

&nbsp;&nbsp;&nbsp; London: 

<input type="radio"  name="selection" value="london" onClick="option=1">

&nbsp;&nbsp;&nbsp; Birmingham:

<input type="radio"  name="selection" value="birmingham" onClick="option=2" />

</form>

<br></br> Click:
<input type="button" value="Submit" onclick="showConfirmationDialog();" /><br></br>

</body>
</html>

… This code basically represents a form for a user to fill in and at the end select one of three option provided via the radio buttons. What I wanted to find out was that how do I get the selection from one radio button which the user will need to select, displayed within the alert box after they press submit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:11:19+00:00Added an answer on May 26, 2026 at 5:11 pm

    You need to loop through the selection radios to get the checked value:

    var selection = document.Radio.selection;
    var selectionResult = "";
    for(var i = 0; i < selection.length; i++) {
        if(selection[i].checked) {
            selectionResult = selection[i].value;
        }
    }
    alert('You chosen:'+'\n'+'\n'+'Name: '+textbox.value +'\n'+'Address: ' +location.value+'\n' + 'Location: '+selectionResult);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
I have a code like this <html> <head>Title <script> function callme() { alert(Hi); document.test.action
I have this code <html> <head> <style type=text/css> .frame {width: 50em; border: 1px solid
I have a code like this. <html> <head> <title>Captcha With Refresh Feature</title> <script src=jquery.js
Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){
I have this function in my Javascript Code that updates html fields with their
Here is my code <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script type=text/javascript src=<%= ResolveUrl(Scripts/jquery-1.3.2.min.js) %>></script>
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; if(form.fName.value ==
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.