Ask Experts Questions for FREE Help !
Ask
    dendenny01's Avatar
    dendenny01 Posts: 5, Reputation: 1
    New Member
     
    #1

    Dec 3, 2011, 07:34 PM
    I cannot understand a part of javascript function saldot()
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <script language="javascript">

    /// Start of Pincode length Validation ///
    function pinlen()
    {
    var n;
    n=f1.t1.value;
    if(n.length<7)

    {
    f1.t1.value="";
    f1.t1.focus();
    return false;
    }
    return true;
    }

    /// Start of Pincode Character validaion ///
    function pinchar()
    {
    var n,i,ch;
    n=f1.t1.value;
    for (i=0;i<n.length;i )
    {
    ch=n.charAt(i);

    if(isNaN(ch)==true)
    {
    f1.t1.value="";
    f1.t1.focus();
    return false;
    break;
    }}
    return true;
    }

    ///Start of Salary Character ///
    function salchar()
    {
    var n,i,ch
    n=f1.t2.value;
    for(i=0;i<n.length;i )
    {
    ch=n.charAt(i);

    if(isNaN(ch)==true && ch!=".")
    {
    f1.t2.value="";
    f1.t2.focus();
    return false;
    break;
    }}
    return true;
    }
    ///Start of Salary dot ///
    function saldot()
    {
    var n,i;
    n=f1.t2.value;
    for (i=0;i<n.length;i )
    {
    ch=n.substring(i,i 1);
    if(ch==".")
    {
    cnt=n.substring(i,n.length);
    if(cnt.length>3)
    {f1.t2.value="";
    f1.t2.focus();
    return false;
    break;
    }}}
    return true;}
    //// Varification steps ////
    function chk()
    {
    if(!pinlen())
    alert ("pincode should not be less tha 6");
    else
    {
    if(!pinchar())
    alert ("not a character");
    else
    {
    if(!salchar())
    alert ("Salary contains invalid Character");
    else
    {
    if(!saldot())
    alert ("Salary contains only 2 digits after dot");
    else
    {
    alert("pincode 7 salary valid");
    }}}}}


    </script>

    <body>

    <form name="f1">
    <h1><center>Validation of Pincode & Salary</center></h1>

    Enter the pincode
    <input type="text" name="t1" maxlength="10"><p>

    Enter the salary
    <input type="text" name="t2" maxlength="10"><p>
    <input type="button" name="b1" value="click" onClick="chk()"><p>
    <!--
    {
    if(!pinlen())
    alert ("pincode should not be less tha 6");
    else









    ---->

    </body>
    </html>

Check out some similar questions!

The result of increasing and decreasing function on the composite function [ 6 Answers ]

I was asked to prove the result of increasing and decreasing function on the composite function... prove that: 1- if f(X) inc & g(X) inc, foG inc 2-if F(X) inc & G(X) dec, foG dec 3- if F(X) dec & G(X) inc, fog dec 4- if f(X) dec & G(X) dec, fog inc please help me in that

Cicular function part 2 [ 1 Answers ]

Sorry to ask these questions again but I just need some ideas on this one or a solution THe body mass of a squirrel living in the will varies during a year, and is given by m=4+cos where (m) kg is the squirrel's body mass (t) months after 1 August. B) For what length of time will the...

Javascript [ 1 Answers ]

I was having problems with java script, now I don't have it at all! I need to download java script to my computer but I can't find anywhere to download it unless you have a verion. I don't have any!!

Javascript [ 2 Answers ]

I want to learn to make games, like runescape, out of javascript. Where is somewhere can learn that? To go to runescape go to www.runescape.com, duh! Anyway. Need help.


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.