D
Delinx32
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).focus();
selectItem(parent.document.getElementById(activeElement));
}
function doLoad()
{parent.document.getElementById('ZIPCODE_DIV').innerHTML='<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=\'getData\';document.MAIN.submit();"
TABINDEX="13" TABORDER="13"id="ZIPCODE" class="gtsmallinput">';}
</SCRIPT>
<BODY ONLOAD="try{parent.document.MAIN.target='';getActiveElement();doLoad();setActiveElement();}catch(err){alert(err.message)};">
</BODY>
</HTML>
Any help would be greatly appreciated.
Thanks.
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).focus();
selectItem(parent.document.getElementById(activeElement));
}
function doLoad()
{parent.document.getElementById('ZIPCODE_DIV').innerHTML='<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=\'getData\';document.MAIN.submit();"
TABINDEX="13" TABORDER="13"id="ZIPCODE" class="gtsmallinput">';}
</SCRIPT>
<BODY ONLOAD="try{parent.document.MAIN.target='';getActiveElement();doLoad();setActiveElement();}catch(err){alert(err.message)};">
</BODY>
</HTML>
Any help would be greatly appreciated.
Thanks.