Hello everyone,
i have got a question regarding radio button when i send the form with the submit button i want it to display the First name Last Name and also a text in the if statement. I think the submit function only works for the first last and email address, i need help submitting the form so it displays all the date. Here is the coding
HTML FILE
<html>
<head>
<title>First Demo</title>
<link href="" rel="stylesheet" media="screen" type="text/css" />
</head>
<body>
<script type="" src =""></script>
<form id="DemoVersion" action="">
Name:
<input type="text" name="firsName"/></br>
Last Name:
<input type="text" name="secondName"/></br>
Please enter your email address:
<input type="text" name="email"/></br>
Would you like pizza or chips?</br>
<input type="radio" name="food" value="Petrol"/> Pizza<br>
<input type="radio" name="food" value="Diesel"/> Chips
<input type="button" value="Submit" onClick="login()"/>
</form>
</body>
</html>
JAVA SCRIPT FILE
function login(){
var myForm=document.getElementById("DemoVersion");
var fName=myForm.firstName.value;
var sName=myForm.secondName.value;
var eAddy=myForm.email.value;
document.write("Hello "+uName+" "+lName+"."+"Your mail account is " +eAdd+".")
}
function process(){
var myForm=document.getElementById("DemoVersion");
if(myForm.engine[0].checked==true){
document.write("Pizza is your choice");
}else{
document.write("Nothing has been selected");
}
}
var btn = document.getElementById("loginBtn");
btn.addEventListener("click", login, false, true)
THANK YOU ANYONE THAT HELPS ME IN ADVANCE.