...

View Full Version : 2 events in one onchange?



sasha85
11-14-2007, 08:38 AM
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...:(

shyam
11-14-2007, 09:43 AM
combine them in a single function


function respOnChange(what) {
enableDisable(what,'listbox2','listbox1','listbox3','closhour','closhour1');
if (what.selectedIndex == 3 ) {
...
}
}

and be sure to use it ;)

<select name="resp" onchange="respOnChange(this)">...</select>

sasha85
11-14-2007, 10:14 AM
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);">

sasha85
11-14-2007, 10:18 AM
thank you!!
you are great:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum