Results 1 to 3 of 3

Thread: 2 events in one onchange?

  1. #1
    Join Date
    Sep 2007
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 2 events in one onchange?

    i got to 2 onchange events...how can i mix them?
    <select name="resp" onChange="enableDisable

    (this,'listbox2','listbox1','listbox3','closhour','closhour1')" onChange="if (this.selectedIndex == 3

    ) { if(!confirm('you pick 3?')) this.selectedIndex=this.oldIndex}; if (this.selectedIndex == 4 ) { if(!

    confirm('you pick 4?')) this.selectedIndex=this.oldIndex}"

    onFocus="this.oldIndex=this.selectedIndex">
    this way it not working...

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Your code looks like garbage because you haven't used the forum's editor's proprietary code tags. In the advanced editor, hit the # symbol and put your code inside the:

    [CODE][/CODE]

    tags that will then appear, or just type your own square bracketed tags (exactly as shown) and use those.

    A general sort of answer though would be that events can be combined. You cannot use more than one event attribute of the same type for the same tag. Let's say you wanted to:

    Code:
    alert('here')
    and:

    Code:
    alert('Hello!')
    You could:

    Code:
    onchange="alert('here');alert('Hello!');"
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2007
    Location
    USA
    Posts
    373
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default

    Code:
    onchange = function(e) {
        alert("hi");
        alert("Hello");
        myFunc(e);
        . . .
    };
    Or you could use event listeners if you are game for learning that.
    Trinithis

Bookmarks

Posting Permissions

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