Jump to content

oblur, onchange and onkeypress


napsternapster

Recommended Posts

Hi ppl,

 

I have a problem with javascript events.

I have created 2 functions with different purposes

 

//function one called onkeypress

function tabBackorFront()

{

  //this function works on checks for tab key and shift

  if(tab == 9 && shift == false)

  {

    shows the next input text or select drop down;

    sets the focus on the next input text or select drop down;

  }

  else if(tab == 9 && shift == true)

  {

    sets the focus to the previous select dropdown or input text

  }

}

 

//function two is called onblur of an input text or onchange of a select dropdown

function ShowNext()

{

  //shows the next input text or select drop down

}

 

//this events are attached as follows to input text and drop down

//input text

  <input type='text'  oblur='javascript:ShowNext()' onkeypress=' javascript:tabBackorFront() />

 

//on select dropdown onkeypress='javascript:tabBackorFront' onchange='javascript:tabBackorFront()

 

I need a way of determineing which function must be called  depending on which event dat has been envoked.

 

I thank you in advice

Link to comment
https://forums.phpfreaks.com/topic/165913-oblur-onchange-and-onkeypress/
Share on other sites

When the onkeypress event is invoked and oblur  is invoked on the input text after the onkeypress event.Same as the onchange and onkeypress.

 

2 of these events they call the same function one after are another.

 

function selectOption(text,current,next,previous,contact_type,detailed_type,e)

{

current = document.getElementById(current);

next  = document.getElementById(next);

previous = document.getElementById(previous);

 

if((e.keyCode == 9 && e.shiftKey == true) || (e.keyCode == 9 && e.shiftKey == false) )

{

  Code  = e.keyCode;

  bool = e.shiftKey;

tabBackorFront(text,current,next,previous,contact_type,detailed_type);

 

}

else

{

ShowNext(text,current,next,previous,contact_type,detailed_type);

}

 

 

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.