Problem between JavaScripts and Mozilla, PLZ help !

Discussion in 'JavaScript' started by brajeshnepal, Feb 9, 2007.

  1. #1
    I have a validation script that works fine with Internet explorer but has problem while executing action with Mozilla. Blow are my validation scripts and submit (action scripts) :

    <script language="javascript">

    function check()
    {
    var first_name=reservation.first_name.value;
    var surname=reservation.surname.value;
    var email=reservation.email.value;
    var security=reservation.security.value;
    var h_security=reservation.h_security.value;


    if(first_name==null || first_name=="")
    {
    alert("Please Enter Your First Name");
    reservation.first_name.focus();
    return false;
    }

    else
    if(surname==null || surname=="")
    {
    alert("Please Enter Your Surname");
    reservation.surname.focus();
    return false;
    }

    else
    if(email==null || email=="")
    {
    alert("Please Enter Your Email Address");
    reservation.email.focus();
    return false;
    }
    else
    if(security!=h_security)
    {
    alert("Please Enter Correct Security No");
    reservation.security.focus();
    return false;
    }
    return true;


    }

    </script>



    Submit Button Scripts :
    <input name="B1" type="submit" class="forms" value="Submit" onclick="return check()">


    What's the problem guys ?????

    Is it because I have other scripts above the one I am having problem with ??
     
    brajeshnepal, Feb 9, 2007 IP
  2. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #2
    Hey brajeshnepal,

    What exactly is reservation? Is it a form object declared above function?
    Try after changing
    var first_name=reservation.first_name.value;
    to
    var first_name=document.reservation.first_name.value;

    May be it works for you.
     
    designcode, Feb 9, 2007 IP
  3. brajeshnepal

    brajeshnepal Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks designcode it worked . Many thanks once again.
     
    brajeshnepal, Feb 9, 2007 IP
  4. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #4
    You're welcome :), I am glad that your problem is solved.
     
    designcode, Feb 9, 2007 IP