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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Two function in one input field

    Can I call two function from one input field? And if so, how?

    Thanks.

    HeadElf

  • #2
    Regular Coder PremiumBlend's Avatar
    Join Date
    Apr 2006
    Location
    Marion, Iowa
    Posts
    201
    Thanks
    0
    Thanked 13 Times in 13 Posts
    You can run two functions from one event, I'm not sure what you mean by one input field though... A text field, button? Whichever it may be, just do it like this:

    Code:
    onmouseover="functionOne();functionTwo();" onclick="functionA();functionB();"
    My Website: DumpsterDoggy

  • #3
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <input type="text" name="Amt1" id="Amt1" size="5" onKeyPress="return tabit(this,event);return goodchars(event,'0123456789.')">
    I'm missing something here, I can tell. Do I pull the "return"s?

    HeadElf

  • #4
    Regular Coder
    Join Date
    Jul 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you're trying to use return to cancel the event just add a logical AND between the functions like so:
    Code:
    return tabit(this,event) && goodchars(event,'0123456789.');

  • #5
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It works wonderfully well! <grin> My thanks!

    HeadElf


  •  

    Posting Permissions

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