Skip to content

Help on this project

Ricky Jj

Asked Apr 17, 2017, 3:12 PM EDT2 answers
Share
LinkedInX

Add a simple form to your web site created in question 2. This web page should contain a label (Name), a text box, a message label, and two buttons (Submit and Clear). The user will type their name in the text box and click on the submit button. In response to the click on the submit button, display the message Good Morning name! (where name is the name typed by the user in the text box) in the message label. If the user click on the clear button then clear the text box and message label.

I used this code:

Enter Name :




Some reason I cant get submit button to display Good Morning and the name?

I would appreciate any help and info

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Shashangka Shekhar
    0
    1. <!DOCTYPE html>  
    2. <html>  
    3. <head>  
    4.      <script type="text/javascript">  
    5.      function SubmitFrm(){  
    6.         var jFirst = document.getElementById("fname").value;  
    7.         var jLast = document.getElementById("lname").value;  
    8.         document.getElementById('message').innerText = "Good Morning " + jFirst + " " + jLast;  
    9.      }  
    10.      </script>  
    11.   
    12.     </head>  
    13. <body>  
    14.     <label id="message"/>  
    15.     <form action="" onSubmit="JavaScript:SubmitFrm()">  
    16.        First name: <input type="text" name="FirstName" id="fname"><br>  
    17.        Last name: <input type="text" name="LastName" id="lname"><br>  
    18.        <input type="submit" value="Submit">  
    19.     </form>  
    20. </body>  
    21. </html>  
    0
  • 1 short reply
    • 0
      Is this in Asp.net coding
      0