Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > DHTML TabIndex Problem with <SELECT>

Reply
Thread Tools

DHTML TabIndex Problem with <SELECT>

 
 
Delinx32
Guest
Posts: n/a
 
      07-16-2004
Hi guys,

I have a pesky problem that I can't seem to shake. I am submitting a
form to an iframe, and on the iframe's onLoad I am replacing the
innerHTML of a <DIV> with a new select or input box.

Basically it works like this:
1)user changes CITY
2)user changes STATE
3)IFRAME runs a cgi exe and fills in the ZIPCODE div with either an
input box(if one zipcode was returned) or a select box(if several were
returned)

When an input box is returned, everything works perfect everytime.
When a select box returns and I set focus to it, the next tab takes me
to the address bar instead of the next element.

The active element stuff is to preserve my tabIndex incase the user
inadvertantly tabs into the field that is about to change before it
actually changes, it works properly.

Don't mind the functions being poorly structured. I thought that the
problem might have been a javascript order of events thing, but it
wasn't, and I left the functions the way they were for now.

There are no duplicate tab indexes.
I've tried parent.document.recalc();

Code Below:

<HTML>
<SCRIPT>
var activeElement;
function getActiveElement()
{activeElement=parent.document.activeElement.id;}

function selectItem(anObject)
{if(anObject.tagName=='INPUT')
{anObject.focus();anObject.select();}
else if(anObject.tagName=='SELECT')
{anObject.focus();}
};

function setActiveElement()
{parent.document.getElementById(activeElement).foc us();
selectItem(parent.document.getElementById(activeEl ement));
}

function doLoad()
{parent.document.getElementById('ZIPCODE_DIV').inn erHTML='<INPUT
TYPE="TEXT" NAME="ZIPCODE" SIZE="6" VALUE="15317"
ONCHANGE="document.MAIN.DATAPARENT.value=\'ZIPCODE \';document.MAIN.DATAFIELD.value=\'CITY\';document .MAIN.target=\'COMM\';document.MAIN.action=\'getDa ta\';document.MAIN.submit();"
TABINDEX="13" TABORDER="13"id="ZIPCODE" class="gtsmallinput">';}

</SCRIPT>

<BODY ONLOAD="try{parent.document.MAIN.target='';getActi veElement();doLoad();setActiveElement();}catch(err ){alert(err.message)};">

</BODY>
</HTML>

Any help would be greatly appreciated.

Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with using tabindex in formview samira455 ASP .Net 0 09-12-2006 12:18 PM
DataGrid problem with tabindex mac ASP .Net Web Controls 0 04-15-2005 11:04 PM
Do any DHTML books cover contemporary DHTML? Steve Javascript 1 04-09-2005 04:16 PM
Tabindex kai ASP .Net 2 01-09-2004 02:38 PM
TabIndex of DataGrids Ravikanth[MVP] ASP .Net 2 07-21-2003 04:09 PM



Advertisments