napsternapster Posted July 17, 2009 Share Posted July 17, 2009 Hi people, I'm using two events(onblur & onkeypress) in one input text(<input type='text' onblur='selectOption(event)' onkeypress='selectOption(event)' >) and these two events they the same function. function selectOption(text,current,next,previous,contact_type,detailed_type,e) { current = document.getElementById(current); next = document.getElementById(next); previous_id = document.getElementById(previous); if(e.type == 'blur' ) { ShowNext(text,current,next,previous,contact_type,detailed_type); } else if(e.type == 'keypress') { Code = e.keyCode; bool = e.shiftKey; tabBackorFront(text,current,next,previous,contact_type,detailed_type); } } My aim on this function is to select which function must be selected after an event has been invoked. function tabBackorFront(text,current,next,previous,contact_type,detailed_type) { to be selected on any pressed } function ShowNext(text,current,next,previous,contact_type,detailed_type) { to be selected onblur of the textbox } the problem is that both of this events are called onblur of the input text when a tab is clicked.Can anyone help me on reading these two events @ the same time Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 17, 2009 Share Posted July 17, 2009 Use onkeyup instead of onkeypress Quote Link to comment Share on other sites More sharing options...
napsternapster Posted July 17, 2009 Author Share Posted July 17, 2009 I tried to use the keyup but the problem is that onblur event is invoked each time the tab+ctrl key is pressed.My aim is control events to be performed.its either onkeyup o onblur event Quote Link to comment Share on other sites More sharing options...
napsternapster Posted July 20, 2009 Author Share Posted July 20, 2009 Hi, on onblur event get you get the reason why the event was invoked on the function which is called by onblur event .e.g onkeypress or when the user blurs the input text. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.