javascript - HTML Radio Button -


i have typed following code in front page , gives error in displaying radio button values (as undefined):

function f1() {          var fn = document.frm.t1.value;          var ln = document.frm.t2.value;          var ad = document.frm.s1.value;          var sex = document.frm.r1.value;          var nat = document.frm.d1.value;          var typ = document.frm.r2.value;          var typ1 = document.frm.c1.value;          var typ2 = document.frm.c2.value;          var typ3 = document.frm.c3.value;          var budg = document.frm.r3.value;          var mail = document.frm.t5.value;          var mob = document.frm.t3.value;          var resi = document.frm.t4.value;          var city = document.frm.d2.value;          var com = document.frm.s2.value;            document.write("welcome dear " + fn + " " + ln + "<br>" + "your residential address " + ad + " , " + nat + " national " + "<br>" + "you looking " + typ + " property " +              " , interested in " + typ1 + " " + typ2 + " " + typ3 + " flat." + "<br>" + " estimated budget inr " + budg + "<br>" +              " informed using e-mail address " + mail + " contacted on mobile number " + mob + " or residence number " + resi + "<br>" +              " looking property in " + city + " city" + " have following comments " + "<br>" + com);      }
body {    background-color: #222;  }
<p align="center">&nbsp;</p>  <p align="left"><font face="berlin sans fb demi" color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      </font>  </p>  <p align="center"><span style="background-color: #ffffff">      <font face="berlin sans fb demi">kindly fill - details given below ,       out customer support team contact shortly!</font></span>  </p>  <p align="left"><font face="berlin sans fb demi" color="#ffffff">      </font>  </p>  <form method="post" name="frm" action="--webbot-self--">      <!--webbot bot="saveresults" u-file="../_private/form_results.csv" s-format="text/csv" s-label-fields="true" startspan -->      <input type="hidden" name="vti-group" value="0">      <!--webbot bot="saveresults" i-checksum="43374" endspan -->      <div align="left">          <table border="1" width="39%">              <tr>                  <td colspan="2">                      <p align="center"><b><font color="#ffff00">inquiry form</font></b>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>first name</b></font>                  </td>                  <td>                      <input type="text" name="t1" size="25">                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>last name</b></font>                  </td>                  <td>                      <input type="text" name="t2" size="25">                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>postal address</b></font>                  </td>                  <td>                      <textarea rows="2" name="s1" cols="20"></textarea>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>gender</b></font>                  </td>                  <td>                      <input type="radio" value="male" name="r1"><font color="#ffffff">male      				</font>                      <input type="radio" value="female" name="r1"><font color="#ffffff">       				female</font>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>nationality</b></font>                  </td>                  <td>                      <select size="1" name="d1">                          <option selected value="indian">indian</option>                          <option value="british">british</option>                          <option value="canadian">canadian</option>                          <option value="chinese">chinese</option>                          <option value="japanese">japanese</option>                          <option value="gcc">mid eastern</option>                      </select>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>looking for</b></font>                  </td>                  <td>                      <input type="radio" name="r2" value="buy" id="1"><font color="#ffffff">buy      				<input type="radio"     name="r2" value="lease">lease</font>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>type</b></font>                  </td>                  <td>                      <input type="checkbox" name="c1" value="1 bhk"><font color="#ffffff">1       				bhk <input type="checkbox" name="c2" value="2 bhk">2 bhk      				<input type="checkbox" name="c3" value="3 bhk">3 bhk</font>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>budget</b></font>                  </td>                  <td>                      <input type="radio" name="r3" value="20-30 lakhs"><font color="#ffffff">20-30       				lakhs</font>                      <p>                          <input type="radio" name="r3" value="40-60 lakhs"><font color="#ffffff">40-60       				lakhs</font>                      </p>                      <p>                          <input type="radio" name="r3" value="more       				than 60 lakhs"><font color="#ffffff">more       				than 60 lakhs</font>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff">e-mail id</font>                  </td>                  <td>                      <input type="text" name="t5" size="20">                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff">phone number</font>                  </td>                  <td>                      <input type="text" name="t3" size="20">                      <font color="#ffffff">mob</font>                      <p>                          <input type="text" name="t4" size="20"><font color="#ffffff">       				res</font>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>preferred city</b></font>                  </td>                  <td>                      <select size="1" name="d2">                          <option selected value="mumbai">mumbai</option>                          <option value="bangalore">bangalore</option>                          <option value="pune">pune</option>                          <option value="ahmedabad">ahmedabad</option>                          <option value="kochi">kochi</option>                      </select>                  </td>              </tr>              <tr>                  <td width="147"><font color="#ffffff"><b>comments</b></font>                  </td>                  <td>                      <textarea rows="2" name="s2" cols="20"></textarea>                  </td>              </tr>          </table>      </div>      <p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          <input type="submit" value="inquire" name="b1" onclick="f1()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          <input type="reset" value="reset" name="b2">      </p>  </form>    <p align="center">      <a href="home.htm">          <img border="0" src="home_1.png" width="75" height="72">      </a>  </p>

rest of things working except radio buttons. kindly solution same. thank in advance

<form>   color prefer?<br>   <input type="radio" name="colors" id="red">red<br>   <input type="radio" name="colors" id="blue">blue </form>  <button onclick="check()">check "red"</button> <button onclick="uncheck()">uncheck "red"</button>  <script> function check() {     document.getelementbyid("red").checked = true; } function uncheck() {     document.getelementbyid("red").checked = false; } </script> 

link:-http://www.w3schools.com/jsref/prop_radio_checked.asp


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -