Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Form Design in Javascript

    Hello

    My Javascript code is coming along well and at present I'm getting my user information using the below code which is working well.

    var nam=prompt("Please enter your name","name");

    My company has Dreamweaver CS6 licenses so I can install it on my work computer and may use this to create a nice form for my web site and have my user input come from a form rather than a prompt.

    For a novice programmer and beginner in web desing, whats the easiest way to make clean looking forms that my javascript code will work with>

    Thannks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    Quote Originally Posted by maximus350zx View Post
    Hello

    My Javascript code is coming along well and at present I'm getting my user information using the below code which is working well.

    var nam=prompt("Please enter your name","name");

    My company has Dreamweaver CS6 licenses so I can install it on my work computer and may use this to create a nice form for my web site and have my user input come from a form rather than a prompt.

    For a novice programmer and beginner in web desing, whats the easiest way to make clean looking forms that my javascript code will work with>

    Thannks
    I am not sure exactly what you mean, but to start with in this century prompt() is not a suitable way of getting user input.

    Dreamweaver is not well thought of around here (use the search feature). It produces bloated, poorly-written and old-fashioned code. Forget it!
    r
    The only sensible advice I can give you is to learn HTML, CSS and Javascript. But that will take more than a few weeks.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    620
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Start with this and expand to suit:

    Code:
    <form method="post" action="javascript:void(0);" onsubmit="DoIt();">
     <div class="form">
      <label for="Name">Name:</label>
      <input type="text" size="20" value="name" name="Name" id="Name" alt="input 1" onfocus="this.select();" />
      <br />
      <input type="submit" value="Submit" title="Submit" />&nbsp;
      <input type="reset" value="Reset" title="Reset" />&nbsp; 
     </div>
    </form>
    
    <script type="text/javascript">
      /*<![CDATA[*/
        function DoIt() {
          nam=document.forms[0].Name.value;
          alert(nam);
          return true;
        }
      /*]]>*/
    </script>


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •