Home Answers Viewqa HTML Problem about coding in ajvascript

 
 


sreekanthkakarla
Problem about coding in ajvascript
2 Answer(s)      11 months ago
Posted in : HTML

I created a three radio buttons in the following way

How many iphone styles are present in the image?

        <input type="radio" name="option" id="option" value="01" /> 01<br />
        <input type="radio" name="option" id="option" value="03" /> 03<br />
        <input type="radio" name="option" id="option" value="05" /> 05<br />
        <input type="button" value="submit" onclick="javascript:checkAnswer()"/><br/>

In the above options one option is correct . if we select one radio button and click on submit I should get whether the option selected is true or false. Can please help me in getting a code using javascript please?

View Answers

June 11, 2012 at 4:17 PM


Here is an example of JavaScript radiobutton. The given code allow the user to select any radio button. If the selected radio button value matches with the supposed answer, it will display true message, otherwise it will return false message. We have made the option 2 as correct answer.

<html>
<head>
<script language = "JavaScript">
     function checkAnswer(selObject) {
          var value = null
          for (var i=0; i<selObject.length; i++) {
               if (selObject[i].checked) {
                    value = selObject[i].value;
                    break ;
               }
          }
          var correctAns='03';
          if(correctAns==value){
          alert("true");
          }
          else{
          alert("false");
          }

     }
</script>
</head>
<body>
    <form name="form1">
    <input type="radio" name="option" value="01">01<br>
    <input type="radio" name="option" value="03">03<br>
    <input type="radio" name="option" value="05">05<br>
    <input type="button" value="submit" onClick="checkAnswer(this.form.option);">
    </form>
</body>
</html>

June 12, 2012 at 11:55 AM


Thank You MY friend. It worked great for me.









Related Pages:
Problem about coding in ajvascript
Problem about coding in ajvascript  I created a three radio buttons in the following way How many iphone styles are present in the image? <input type="radio" name="option" id="option" value="01" /> 01<br />
problem in coding
problem in coding  i have a following code which display the contents of the text file but not other program like java or any c program is there any handler to open the program files other than Filereader. FileReader fr = new
CODING
FROM Person WHERE LName = 'deepak' Read more about SQL Delete statement
problem i coding
problem i coding  i have a problem in coding a combobox containing a number of *.java program on click one of them that program should compile and run and display the result in other window
coding problem - Java Beginners
coding problem  hi friend! Im new to jasper reports.how can i start that coding inorder to generate reports.can u send some sample programs for reporting?im badly need some clearly mentioned example because im new to jasper
Please provide the coding for this problem
Please provide the coding for this problem  Please provide the coding for the following problem. Write a "hangman" game that randomly generates a word and prompts the user to guess one letter at a time. Each letter in the word
coding problem - JSP-Servlet
coding problem  dear sir will u plz tell me how can we delete a record from the database(MSaccess) when option in the combobox is selected(jsp)  If u want to delete the record from database, by seleting
about .net coding
about .net coding  please suggest me the code used for viewing a page in .net language
coding problem - JSP-Servlet
coding problem  dear sir i m very new to JSP sir i m getting problem in dynamically changing the option of combobox from database(ms acess) .and after that option being selected for that the record from the databse should
about coding - Java Beginners
about coding  hello sir, I want to create session expair, when user is not enter anything in login page session wil expair after 10 min.if user enter its go to success page.plz send me full code about this. thanks
coding problem - Java Beginners
coding problem  i had a big doubt. public ArrayList readExpenseType() throws ClassNotFoundException, SQLException,Exception { DBConnection dbc = new DBConnection(); Connection con = dbc.getConnection(); ArrayList
coding problem - JSP-Servlet
coding problem  Dear sir i m very new to JSP .I am using two conbobox .if any option is selected in first combobox then only its data from the database should be displayed in other combobox, means how can we refresh
coding problem - Java Beginners
coding problem  i used netbeans software to develop frame.now i need to add values to JList from ArrayList object  Hi Friend, Try the following code: import java.util.*; import javax.swing.*; public class
coding problem - Java Beginners
coding problem  hi! i declared date as date datatype in oracle now i need to retrieve date from database to my java code.how can i please help me urgent   Hi Friend, We are providing you a code that will retrieve
Problem in coding - Java Beginners
Problem in coding  How many times do you have to roll a pair of dice before they come up snake eyes? You could do the experiment by rolling the dice... friend, Code to help in solving the problem. public class Stimulates
mvc coding - JavaMail
mvc coding  Hi friends, I am facing this problem, I created .vm files and class files in eclipse but velocity.log file show this problem...; Hi friend, Read for more information about mvc http
Please provide coding for following problem
Please provide coding for following problem  Please provide the coding for the following problem: You will write a java program that will read data from a file. The data in the file will be: John Doe 75 Joe Blow 65 Mary Smith 80
coding problem in netbeans - Java Beginners
coding problem in netbeans  hi, i have just started programming in netbeans,i'm facing a problem in a java application i create a jframe class and jbutton and jtextfeild inside it now i have created another class c1
Java Coding Problem - Java Beginners
Java Coding Problem  Q.1 How to write a while loop that displays all even numbers till 40? Q.2 How to write a method that accepts an integer parameter and displays the divisors of that integer?  Hi friend
program coding
program coding  how to rearrange the array a[1]. . a[n] even elements and odd elements? please give the example coding program.please provide the coding for this problem
problem in writing coding. Please help me.
problem in writing coding. Please help me.  Hi sir, my name is Logeswaran. I have problem in writing JSP coding for my university assigments. Actually I'm doing a Voting System. I need to know how to write JSP coding
coding problem using vb and access - Security
coding problem using vb and access  i have problem on coding using vb on register button.when i click the label link it will terminate that program.so hard for me.i have no idea. then i also have problem on update,delete and add
Problem
(UnknownHostException e) { System.err.println("Don't know about host
problem to do coding upload image in php
problem to do coding upload image in php  can i get example coding how to upload image in php?i have try it but i dont no wheter it is correct or not because i can't save the image in folder and not connected to database mysql
Problem
) { System.err.println("Don't know about host: sunil-PC."); System.exit(1
java coding
java coding  i need to to a project in java and the title is file parsing. i need to read a file or if a particular file is given i have to count the no of vowels, pick out some terms, and to display the details about that file
CODING TEST
CODING TEST  Problem Statement Consider a inter dealer-broker network which various financial stock brokers use to execute customer stock trading...¢ Coding productivity (more time you take to submit the exercise, lesser you
CODING TEST
CODING TEST  Problem Statement Consider a inter dealer-broker network which various financial stock brokers use to execute customer stock trading...¢ Coding productivity (more time you take to submit the exercise, lesser you
Java Programming and Coding problem - Java Beginners
Java Programming and Coding problem  How write a program that helps the user count his change. The program should ask how many quarters the user has, then how many dimes, then how many nickels, then how many pennies
What do you think about client-side/server-side coding ?
What do you think about client-side/server-side coding ?  Hi, What do you think about client-side/server-side coding
j2me coding - Java Magazine
in sms using j2me. i have a problem in coding for sending and receiving sms .i have a coding for receiving sms but it not work because that program need sending sms using port no.please give me a solution for this problem............ give me
Medical coding training
Medical coding training  Hi, What is Medical coding training course? How anyone can make career in Medical coding training? Thanks   Hi, Medical coding training can be a good career for any graduate. It's one
jsp coding please.
jsp coding please.  hi sir, my name is logeswaran. I have a problem in jsp, that i need to get value like a person name from database into drop down... database and coding JSP.   Follow these steps: 1)Go to the start->
coding
coding  I need the logout coding. can you please help me.   Please visit the following links: http://www.roseindia.net/quickguide/tomcat/Logout.shtml http://www.roseindia.net/jsp/loginstatus.shtml
Date Coding - JSP-Servlet
that semester is completed.i am facing code problem
Java Coding - Java Beginners
; Hi friend, Code to solve the problem : import java.io.*; class...); } } Thanks   Hi friend, Code to solve the problem..., Code to solve the problem : import java.io.*; class ShippingMethod1
Java Coding - Java Beginners
; and 3.50 otherwise.  Hi friend, Code to solve the problem : import
Java Coding - Java Beginners
the problem : public class bubbleSort{ public static void main(String a[]){ int
Java Coding - Java Beginners
the problem : import java.io.*; class ShippingMethod1 { public static
netbeans coding prob - IDE Questions
netbeans coding prob  hi, i have just started programming in netbeans,i'm facing a problem in a java application i create a jframe class and jbutton and jtextfeild inside it now i have created another class c1 and i want
Java while coding - Java Beginners
Java while coding  Java loop and function coding question? How can I write an application that accepts a person's weight and displays the number..., Code to help in solving the problem : import java.io.*; class Computation
Connected Mode and Dissconnect mode coding concept.
Connected Mode and Dissconnect mode coding concept.  Tell Me about Connected Mode and Dissconnect mode coding concept. also give me some syantax
About Java2
About Java2  sir i want to a develop one text editor but the problem is that i m not able to save our file as text formet or any formet Sir plz guide me

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.