Javascript works in Firefox not in IE8

XLITS
XLITS used Ask the Experts™
on
I've got this javascript that works in Firefox but it fails to pass the value of the drop down box in Internet Explorer (I'm using IE8).  The script is a simple script to reload the page on the onchange event of a drop down box.  It should pass the value of the box in the URL.  Here is the script:

function HandleChange() {
       parent.document.location.href="returns.asp?csoval=" + document.forms[0].txtCSO.value;
}

The name of the drop down box is txtCSO.

Any help is appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
function HandleChange() {
       document.location.href="returns.asp?csoval=" + document.forms[0].txtCSO.value;
}

or

function HandleChange() {
       document.location.href='"returns.asp?csoval=" + document.forms[0].txtCSO.value+"'";
}
Project Lead
Top Expert 2011
Commented:
Check this code...
<html>
   <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" language="JavaScript" type="text/javascript"></script> 
     <script>
        $(document).ready(function () {
          $('#txtCSO').change(function(){
             window.location.href="returns.asp?csoval="+ $(this).val();
          });
        });
     </script>
   </head>
   <body>
<form id="form1">
 <div>
         
      <select name="txtCSO" id="txtCSO">
        <option value="option1">option1</option>
        <option value="option2">option2</option>
        <option value="option3">option3</option>
      </select>
        </div>
    </form>
    </body>
    </html>

Open in new window

Kiran SonawaneProject Lead
Top Expert 2011

Commented:
For cross browser safety you can use window.location rather than document.location. If you want same code then replace 'parent.document.location.href' with 'window.location.href'.

Author

Commented:
No matter what I tried with the onchange event it just wouldn't work.  I used this script and it did just what I needed in both IE and Firefox.  Thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial