In today’s lesson, we talk about how to accept input from a message box or an HTML form from the user, and process that input to output a message to either a …

source

28 Comments

  1. Thanks! I had created a simple minutes to hours converter and couldn't figure out why the hours wouldn't output to the page.

  2. This tutorial was very helpful on demonstrating how to retrieve information that is typed into the input field and displaying the information on to the screen or as it is called the DOM. Thanks for that bit of information.Now, I would if you could make a tutorial on how to add multiple elements from the input field and displaying on the DOM.

  3. what is wrong with this code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>InputMania</title>
    </head>
    <body>
    <form id="age">
    Your age:<input name="name" type="text" size="3">
    </form>
    <form id="hobby">
    Your hobby/hobbies:<input name="name2" type="text" size="40">
    </form>
    <form id="name1">
    Your first name:<input name="name3" type="text" size="20">
    </form>
    <form id="name2">
    Your middle name:<input name="name4" type="text" size="20">
    </form>
    <form id="name3">
    Your last name:<input name="name5" type="text" size="20">
    </form>
    <form id="pname">
    Where you live:<input name="name6" type="text" size="20">
    </form>
    <button onclick="detailsoutput()">Submit your details</button>

    <script type="text/javascript">
    function detailsoutput() {
    var x,y;
    x = [document.getElementById(age), document.getElementById(hobby), document.getElementById(name1), document.getElementById(name2), document.getElementById(name3), document.getElementById(pname)];
    y = [x[0].elements["name"].value, x[1].elements["name"].value, x[2].elements["name"].value, x[3].elements["name"].value, x[4].elements["name"].value, x[5].elements["name"].value];
    document.getElementById("demo").innerHTML="Your name is: <br>"+y[2]+" "+y[3]+" "+y[4];
    document.getElementById("demo").innerHTML+="Your age is: <br>"+y[0]"<br>" "Your hobby/hobbies is/are:<br>"+y[1] "<br>" "You live in:"+y[5];
    }
    </script>
    <p id="demo"></p>
    </body>
    </html>

  4. I am unable to get this to prompt me:                                                                                         <DOCTYPE html>                                                                                        <html>                                                                                                                                 <head>                                                                                                                                    </head>                                                                                                                                        <body>                                                                                                                                   <script>                                                                                                                                             var name;                                                                                                                                         name = prompt("Please Enter The Subject")                                                                window.open("http://www.google.co.uk/search?q="+name)                                              </script>                                                                                                                                </body>                                                                                                                                              </html>                                                                                                                                       Could you tell me what I am doing wrong?

  5. Hello Magic Monk Tutorials
    How can I make that the Imput tag is cleared automaticly after submitting it?

    Nice tuto 😀

  6. I copied the script exactly, and it doesn't do anything when I click the submit button. I visited the website, and it doesn't do anything when you click the submit button either. Please help!

  7. I changed a few things but i cant seem to get the words to stay on the page they come up for like half a second. Please help !!! Also this is a very good vid.

Leave A Reply

Please enter your comment!
Please enter your name here