- <html>
- <head>
- <title>form tag</title>
- <script type="text/javascript">
- function color(){
- var txtsubobj=document.getElementById("txtFN");
- var selobj=document.getElementById("sel");
- var divtestobj = document.getElementById("divtest");
- divtestobj.innerHTML = selobj.options.length;
- }
- </script>
- </head>
- <body id="body">
- <table id="table" style="border:5px;background-color:grey;margin-left:400px;margin-top:250px;">
- <tr><th>form tag</th></tr>
- <tr><td><form id="form">
- first name:<input id="txtFN" type="text" value="" name="fname"></input><br/><br/>
- last name :<input id="txtLN" type="text"value="" name="sname">
- <select id="sel">
- <option value="volvo">Volvo</option>
- <option value="saab">Saab</option>
- <option value="mercedes">Mercedes</option>
- <option value="audi">Audi</option>
- </select>
- </input><br/>
- <br/>
- <input id="txtradm" type="radio" name="sex">male</input>
- <input id="txtradf" type="radio" name="sex">female</input><br/>
- <input id="txtcbox" type="checkbox" checked="checked">sure</input><br/>
- <textarea rows="4" cols="50">
- http://prashantanandjha.blogspot.in/.
- </textarea>
- <input id="txtsub" onclick="color();" type="submit" name="submit"></input>
- <div id="divtest">
- </div>
- </td></tr>
- </table>
- </form>
- </body>
- </html>
Wednesday, 4 February 2015
Create an HTML form to print contents of a form on the HTML page using JavaScript.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment