Register  |  Login


Question

Status: Open Points: 75 Time: 12:57 - Apr 09, 2008  

texaspancake

how do you resolve 'options' is null or not an object in Internet Explorer?

I am currently working on an issue with an e-commerce page that goes to a form to enter your information. The order process works fine but there is an annoying issue with Internet Explorer stating.... A Runtime Error has occured. Do you wish to Debug... Etc Error: 'options' is null or not an object. I looked at the code to debug and this is the particular problem area

function init_state_menu(country_field) {
var country_menu = document.getElementsByName(country_field)[0];
var country_id = country_menu.options[country_menu.selectedIndex].value;
generateStates(country_field, country_id);
}

I ran a test to see if the variable country_menu is defined and it states that is not defined. Any suggestions are appreciated. Thanks

Answer Discussion
Answer Summaries

 

Q&A System for Websites and Corporate Collaboration

Advertisement

  • Generates significant organic traffic for websites
  • Saves companies money, resources, and time

paziek

Date:: Jul 11, 2008

Time:: 17:52

if(typeof(window.external) != 'undefined'){

//yes, this is evil browser sniffing, but only IE has this bug

document.getElementsByName = function(name, tag){
if(!tag){
tag = '*';
}
var elems = document.getElementsByTagName(tag);
var res = []
for(var i=0;i<elems.length;i++){
att = elems[i].getAttribute('name');
if(att == name) {
res.push(elems[i]);
}
}
return res;
}

}

its from msdn forums
ps. tag is optional for this method, it will default to wildcard * if not specified (meaning it will check all elements in the document for given name)

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Summaries cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use


Top Errors Experts

View More

Rank

Expert

Points

1.

nidhi

250

2.

oracleofDelphi

100

3.

mrps2man

60

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es