Results 1 to 15 of 20

Thread: help with code

Threaded View

  1. #18
    Join Date
    May 2006
    Somewhere behind your screen
    the html is better ))

    as for javascript... my english is not good. it seems i used wrong word when wrote about "pair". i think it would be much better if somebody explain everything to you in right good english

    anyway, here is the code which works:

    <!DOCTYPE html>
    <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"/>
    <title>enter you number</title>
    <script type="text/javascript">
    function formValidator(){
    var max = 99;
    var min = 1;
    var val = parseInt(document.forms['myform'].elements['firstname'].value);
    var res = document.getElementById('result');
    if((val <= min) || (val >= max)){res.innerHTML = "Wrong number!";}
    else{res.innerHTML = "The number is between 1 and 99";}
    <hr />
    <h1>enter your number</h1>
    <hr />
    <p>Note: all fields are mandatory.</p>
    <form name="myform">
    enter number between 1-99999: <input type="text" name="firstname" />
    <br /><br />
    <input type="button" value="Check it up" onclick="formValidator()" />
    <br /><br />
    <div id="result"></div>
    Last edited by Padonak; 04-26-2012 at 04:39 PM.
    signature under construction

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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