How to display manually entered string values in text boxes using JavaScript & HTML on the same webpage? -
i trying write following source code displaying manually entered(from keyboard) text in text boxes using submit button: html + javascript source:
<html> <head> <title>insert values</title> </head> <body> <form id="form1"> title: <input type="text" id="title1" size="25"><br /><br /> description: <input type="text" id="desc1" size="55"><br /><br /> <input type="button" value="submit" onclick="doit();"> </form> <script type="text/javascript"> function doit(){ var title = document.getelementbyid("title1").value; var desc = document.getelementbyid("desc1").value; document.write("<h3>title : </h3>" + title + <br />); document.write("<h3>description : </h3>" + desc); } </script> </body>
when use debugger trace errors, gives message "unfound syntax error" using browser's debugger. when webpage loaded in browser, displays text boxes & submit button, though after entering text & clicking on submit button, nothing happens!
here are:
function doit() { var title = document.getelementbyid("title1").value; var desc = document.getelementbyid("desc1").value; document.write("<h3>title : </h3>" + title + "< br / >"); // here document.write("<h3>description : </h3>" + desc); }
hope help.
Comments
Post a Comment