dcsimg
www.webdeveloper.com
Results 1 to 9 of 9

Thread: Calling Javascript Functions

  1. #1
    Join Date
    Mar 2003
    Posts
    5

    Question Calling Javascript Functions

    Hi all in my forms/textareas that I want to validate, how do I call on functions such as this?



    function isEmail (s)
    { if (isEmpty(s))
    if (isEmail.arguments.length == 1) return defaultEmptyOK;
    else return (isEmail.arguments[1] == true);

    // is s whitespace?
    if (isWhitespace(s)) return false;

    // there must be >= 1 character before @, so we
    // start looking at character position 1
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
    }






    AND THIS?












    // Checks to see if a required field is blank. If it is, a warning
    // message is displayed...

    function ForceEntry(objField, FieldName)
    {
    var strField = new String(objField.value);
    if (isWhitespace(strField)) {
    alert("You need to enter information for " + FieldName);
    objField.focus();
    objField.select();
    return false;
    }

    return true;
    }

  2. #2
    Join Date
    Jan 2003
    Location
    Jersey Girl
    Posts
    1,198
    You just posted this exact same question less than 30 minutes ago (in the same forum!).

    It's 1am on the east coast (US).
    Do you really expect that there is a team of javascript agents waiting around to answer your question immediately?

    Do you think that maybe no one saw it the first time? (it's sitting right on top!)

    Yikes! Where do you people come from?
    Manners and patience go a long way in this forum.
    Try some.

  3. #3
    Join Date
    Jan 2003
    Location
    Cardiff, Wales, UK
    Posts
    208
    Alyways got something to say, eh Khaki?

    Can't you just let these people be - seems like you get riled too easily!

  4. #4
    Join Date
    Mar 2003
    Location
    Mtl, Canada
    Posts
    90
    Calling the function?
    This question doesn't make sense to me, you seem to know how to validate a form field but you want to know how to call a function?

    Some thing like onBlur="somefunction('this.value')" or onChange(somefunction(this.value,'the name of this field')" ) if you have multiple fields. Or maybe onSubmit?

    is it calling the function or passsing the info to it or the actuall function you want help with?


    p.s if this sounds wrong I'm sorry I'm not what you would call an expert.
    Last edited by Ice3T; 03-28-2003 at 08:47 AM.

  5. #5
    Join Date
    Jan 2003
    Location
    Jersey Girl
    Posts
    1,198
    Alyways got something to say, eh Khaki?

    Can't you just let these people be - seems like you get riled too easily!
    Well... i certainly regret having said it at this point (although that doesn't change the way I feel about it).

    in the future i will try to resist the temptation to "say something".

    (it's really amazing though... the people who try to help others here catch all kinds of flak for trying to maintain a certain "respectful" environment where we don't have to feel like we are being used and abused.... yet the one's who make demands and stamp their feet for help are given a free pass every time.
    i don't know....maybe it's just time for me to take a self-imposed break from this for a while. it's not my intention to be disrespectful, and maybe i'm failing in my efforts.
    my sincere apologies to whoever may be offended by my statements.
    k)

  6. #6
    Join Date
    Mar 2003
    Posts
    5
    Wake up Khaki
    Yes maybe to your complete suprise there is actually another world outside the USA if you would open up your eyes just a little. Maybe get away from your PC for just a few seconds, and go outside into the real world, how's that for an idea?

    Yes the 2nd post was an accident, as the first post produced an error, I came back to my computer and resubmitted the post, but obviously it has gone through. So why dont you just send me to prison?

    Thanks for the shot Ice3T.

  7. #7

    blah

    blah
    Last edited by Code One; 03-31-2003 at 11:38 PM.

  8. #8
    Join Date
    Jan 2003
    Location
    Jersey Girl
    Posts
    1,198
    Ignore her people she's a huge lamer
    I guess that you are just going to keep on taking shots at me... and that's fine.

    And maybe i am a "huge lamer". whatever.
    it doesn't matter.

    I can be an easy target sometimes...
    I know that.
    Have your fun at my expense.

    i'll just continue to be me... and if people don't like me...
    there's nothing that I can do about that.
    k

  9. #9

    blah

    blah
    Last edited by Code One; 03-31-2003 at 11:39 PM.

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



Recent Articles