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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Netscape 2 events in one onchange?

    i got to 2 onchange events...how can i mix them?
    Code:
    <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...
    By the time u recognize this moment, This moment will be gone.

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    combine them in a single function

    Code:
    function respOnChange(what) {
      enableDisable(what,'listbox2','listbox1','listbox3','closhour','closhour1');
      if (what.selectedIndex == 3 ) { 
        ...
      }
    }
    and be sure to use it
    Code:
    <select name="resp" onchange="respOnChange(this)">...</select>
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • Users who have thanked shyam for this post:

    sasha85 (11-14-2007)

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    like this?

    Code:
    function confirmIt (ele) {
    enableDisable(ele,'listbox2','listbox1','listbox3','closhour','closhour1');
    
    if (ele.selectedIndex == 3 ) {
     if(!confirm('you pick 3?')) ele.selectedIndex=ele.oldIndex; 
    } 
    if (ele.selectedIndex == 4 ) { 
     if(!confirm('you pick 4?')) ele.selectedIndex=ele.oldIndex;
    }
    }
    
    </script>
    
    
    
    <select onFocus="this.oldIndex=this.selectedIndex" onChange="confirmIt(this);">
    Last edited by sasha85; 11-14-2007 at 10:22 AM.
    By the time u recognize this moment, This moment will be gone.

  • #4
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    that is all my code:

    thank you!!
    you are great
    Last edited by sasha85; 11-14-2007 at 10:21 AM.
    By the time u recognize this moment, This moment will be gone.


  •  

    Posting Permissions

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