JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Javascript questionnaire Posted by C-user on 20 Feb 2012 at 6:49 AM
Hi, I'm a beginner to Javascript and still learning.. Pls share the correct step how to show result output of Question1+Question2 using Javascript?

For example if user clicked "2" on Question1 and "3" on Question2, popup windows will show the result 5.

<HTML>
<HEAD><TITLE>TESTING QUESTIONAIRE</TITLE></HEAD>
<SCRIPT language="javascript">
function calc1(a,b)
{
var a=document.frm.no1.value;
var b=document.frm.no2.value;
var total=a+b;

alert(total);
alert("Hello world!");

}
</SCRIPT>

<BODY><BR>
<TABLE BORDER=1 CELLSPACING=0><FORM NAME="frm" METHOD="POST" ONSUBMIT="return calc1()">
<TR><TD>QUESTION1 :</TD><TD><input type="radio" name="no1" value=1><B>1</B></TD><TD><input type="radio" name="no1" value=2><B>2</B></TD></TR>

<TR><TD>QUESTION2 :</TD><TD><input type="radio" name="no2" value=2><B>2</B></TD><TD><input type="radio" name="no2" value=3><B>3</B></TD></TD>
</TABLE>

<BR>
<INPUT TYPE="submit" VALUE="SUBMIT"></FORM>
</BODY>
</HTML>



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.