Rottingham Posted April 20, 2007 Share Posted April 20, 2007 I have a PHP page that includes a <select> box, with a function to refresh the page when you click on a different option. For some reason, the JS script reports on error on IE and works perfectly in Firefox. I test each stage of my development between both for compatibility, but this is driving me nuts. function change_family(elem_id) { var elem = document.getElementById(elem_id); var elem_options = document.getElementById(elem_id).options; var family_id = elem.selectedIndex; family_id = elem.options[family_id].value; window.location="family.php?search&view="+family_id; } The Database ID of the family is stored in the <option value="[iD]"> field. So when change_family is called, it gets that ID number and refreshes the page. The problem is that IE reports: 'options' is null or not an object. In firefox, it works GREAT! And so far, I have many many JS scripts that do near identical steps, and it works find in IE and Firefox. Any outsiders looking in have good idea what the problem is? Thanks a ton. Quote Link to comment Share on other sites More sharing options...
nogray Posted April 20, 2007 Share Posted April 20, 2007 That's way too much code, the select menu have the value of it's selected option. You can do something like this <select onchange="location.href='family.php?search&view='+this.value;"> <option value="[iD]">option</option> ..... Quote Link to comment Share on other sites More sharing options...
Rottingham Posted April 20, 2007 Author Share Posted April 20, 2007 Wow thanks! I had no idea about that. I don't play with JS often. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.