Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fill text field not working in Mozilla, ok in Opera 1

Status
Not open for further replies.

lagc

Programmer
Jan 21, 2009
79
GB
I have an admin page that has a country selection field that is populated dynamically, and then on choice of country a region field is made available, and the regions for that country only are displayed, to be selected.

In Mozilla when i choose the country, the region drop down doesnt extend itself so that the countries can be seen, but they are there if you know what i mean. Ican scroll up and down, but cant see the countries to see what they are. But in Opera its fine.

I have posted the code below for you to see.

Code:
function fillregion(countryid)
{
var i=0;
document.form1.selregion.options.length=0;
for(j=0;j<=countryregion.length;j++)
{			
if(countryregion[j]==countryid)
{
			
document.form1.selregion.options[i] = new Option()
				document.form1.selregion.options[i].value=j;
				document.form1.selregion.options[i].innerText=region[j];
i++;
}
}
	
if(countryid==0 || i==0 )
{
					document.form1.selregion.options[0] = new Option()
					document.form1.selregion.options[0].value=0;
					document.form1.selregion.options[0].innerText="Anywhere";
}
}
 
Hi

See thread216-1582960.

Instead of setting the properties better pass parameters to the constructor.
Code:
[gray]// instead of this[/gray]
document[teal].[/teal]form1[teal].[/teal]selregion[teal].[/teal]options[teal][[/teal]i[teal]][/teal] [teal]=[/teal] [b]new[/b] [COLOR=darkgoldenrod]Option[/color][teal]()[/teal]
document[teal].[/teal]form1[teal].[/teal]selregion[teal].[/teal]options[teal][[/teal]i[teal]].[/teal]value[teal]=[/teal][highlight]j[/highlight][teal];[/teal]
document[teal].[/teal]form1[teal].[/teal]selregion[teal].[/teal]options[teal][[/teal]i[teal]].[/teal]innerText[teal]=[/teal][highlight pink]region[teal][[/teal]j[teal]][/teal][/highlight][teal];[/teal]
[gray]// use this[/gray]
document[teal].[/teal]form1[teal].[/teal]selregion[teal].[/teal]options[teal][[/teal]i[teal]][/teal] [teal]=[/teal] [b]new[/b] [COLOR=darkgoldenrod]Option[/color][teal]([/teal][highlight pink]region[teal][[/teal]j[teal]][/teal][/highlight][teal],[/teal][highlight]j[/highlight][teal])[/teal]

Feherke.
 
Looks suspicious.
>j<=countryregion.length
[tt]j[red]<[/red]countryregion.length[/tt]
 
Thanks again Feherke, it worked a treat that.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top