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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Problem - Help Required ..

Status
Not open for further replies.

stirnpanzer

Programmer
Sep 23, 2002
2
GB
hi,

i have a combobox with a "OnChange" event...

What i am attempting to do is set, div id 'night' = Block or None
if the selection = "Accomodation" , i am getting "Object Required" after the //Fails here.......

What am i doing wrong ????????




var f = document.forms[0];
var x;

x = (f.PerferredAirline1.options[f.PerferredAirline1.options.selectedIndex].text);

if(x=='Accomodation') {

alert("if");
//fails here ...........

document.getElementById('night').style.display='none';
}else{

alert("else");

//fails here ...........
document.getElementById('night').style.display='block';
}
 
Presumably, you do not have any element with an "ID" attribute set to "night" on your page at the time the script is run.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
thanks for the reply.....

I had a typo in my Div tag ... hence the problem..

Thanks for the reply.

M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top