Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 80339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:17:14+00:00 2026-05-10T21:17:14+00:00

I have a JavaScript snippet that runs very well on Firefox and Safari, but

  • 0

I have a JavaScript snippet that runs very well on Firefox and Safari, but refuses to run on IE:

var drop= function(id) {    if(document.getElementById('select1').value == 'Ficha de pediatria'){     top.location.href = 'print.jsp?id='+id+'&type=2';    }    else if(document.getElementById('select1').value == 'Ficha normal'){         top.location.href = 'print.jsp?id='+id+'&type=1';    } }  <select id='select1' name='select1' onChange='drop(id);return false;'> <option>Imprimir:</option> <option>Ficha de pediatria</option> <option>Ficha normal</option> </select> 

I trimed this as it had more JSP code but it’ remained the same. Anyone got any idea why it’s not running on IE?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:17:14+00:00Added an answer on May 10, 2026 at 9:17 pm

    [EDIT] Sorry. I introduced an error with my first post by not carefully looking at how you are constructing your url. I shouldn’t have removed the id parameter. I’ve updated the code and it should work now.

    Try this instead:

    function drop(ctl,id) {    var value = ctl.options[ctl.selectedIndex].value;     if(value == 'Ficha de pediatria'){        window.top.location.href = 'print.jsp?id='+id+'&type=2';    }    else if (value == 'Ficha normal'){        window.top.location.href = 'print.jsp?id='+id+'&type=1';    } }  <select id='select1' name='select1' onChange='drop(this,id);return false;'> <option>Imprimir:</option> <option>Ficha de pediatria</option> <option>Ficha normal</option> </select> 

    [EDIT] A bit of explanation…

    I think the issue is how it is accessing the DOM. I don’t think that IE has a value property on a select. I think you have to get at it via the selected option. Also, I’m not sure that there is a top property in the global namespace, but you should be able to get at it via window.top to set the location. Finally, I made a slight improvement in that by specifying this as the argument, you can skip the element lookup and reference it directly from the control passed as the argument.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot write Javascript but I have a snippet that I'm adding into a
I have a function that returns a snippet of JavaScript and/or HTML. static public
I have simple JavaScript snippet: var obrazek = [{nazwa: "Sniadanie", wiek: 100, autor: "Alicja"},{nazwa:
I have a snippet of javascript that displays the amount of sessions available for
I have the following Javascript snippet that receives an customerID via parameter (i'm going
I have the following (fairly) simple JavaScript snippet that I have wired into Greasemonkey.
I have a javascript (jquery) snippet that is link to a href=# to toggle
I have a javascript function that calls a web service. The data comeback (I
Consider this JavaScript code snippet: Object.prototype.log = function() { // here, you have a
Can you guys help me figure this out? I have the following JavaScript snippet:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.