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
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);

}

 

 

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.