function load1(){
var url;
url = 'index_mexer.php?UF='+document.Section.UF[document.Section.UF.selectedIndex].value;
document.Section.SubSec.options.length = 0;
addItem(document.Section.SubSec,"Wait...loading","",false,document.Section.SubSec.length)
myIframe.location = url;
//document.Section.SubSec[document.Section.SubSec.selectedIndex].focus()
}
//////////////i don't know why is not putting the selected option on focus after loading the 2 others select's
function start_sub(){
local1 = new Array();
var maximo1, i, campo1;
local1 = myIframe.loc;
campo1 = document.Section.SubSec;
maximo1 = local1.length;
document.Section.SubSec.options.length = 0;
addItem(campo1,'-Choose one-','',false,campo1.length);
for (i=0;i<maximo1;i++){
addItem(campo1,local1[i][1],local1[i][0],false,campo1.length);
}
}
function load2(){
var url2,url3;
url2= 'index_mexer.php?SubSec='+document.Section.SubSec[document.Section.SubSec.selectedIndex].value;
document.Section.D2.options.length = 0;
addItem(document.Section.D2,"Wait...loading","",false,document.Section.D2.length)
my2frame.location = url2;
// document.Section.D2.focus()
}
function start_key(){
local2 = new Array();
var maximo2, k, campo2;
local2 = my2frame.loc2;
campo2 = document.Section.D2;
maximo2 = local2.length;
document.Section.D2.options.length = 0;
for (k=0;k<maximo2;k++){
addItem(campo2,local2[k][1],local2[k][0],false,campo2.length);
}
}
function addItem(obj,strText,strValue,blSel,intPos){
var newOpt,i,ArTemp,selIndex;
selIndex = (blSel)?intPos:obj.selectedIndex;
newOpt = new Option(strText,strValue);
Len = obj.options.length+1
if (intPos > Len) return
obj.options.length = Len
if (intPos != Len) {
ArTemp = new Array();
for(i=intPos;i<obj.options.length-1;i++)
ArTemp[i] = Array(obj.options[i].text,obj.options[i].value);
for(i=intPos+1;i<Len;i++)
obj.options[i] = new Option(ArTemp[i-1][0],ArTemp[i-1][1]);
}
obj.options[intPos] = newOpt;
if (selIndex > intPos)
obj.selectedIndex = selIndex+1;
else if (selIndex == intPos)
obj.selectedIndex = intPos;
}
</script>
Bom dia a tod@s!
tenho um problema que ja se arrasta a alguns dias... de um select onchange influencia o segundo e este por sua vez onchange influencia um terceiro. A questao e que quando faz o load no fim o campo selecionado do segundo volta sempre a "choose one" ---- addItem(campo1,'-Choose one-','',false,campo1.length);
Queria que este select mantivesse seleccionado o campo que escolhi...mas volta sempre ao "choose one" no load do 3o select. why????
