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

  • SEARCH
  • Home
  • 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 642731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:12:18+00:00 2026-05-13T21:12:18+00:00

I have the following script that works well in Firefox and Chrome (not sure

  • 0

I have the following script that works well in Firefox and Chrome (not sure about other browsers), but it doesn’t work at all in IE. It basically opens a popup which appends a div to highlight an item in the window opener. I want it to work across multiple pages on the same site, so I didn’t want to add a function to create the div in the main window (window.opener). Sorry I couldn’t post a working demo – window.opener doesn’t work in a bin.

<button>Open popup</button>
<script type="text/javascript">
$(document).ready(function(){
 $(':button').click(function(){
  var highlight = "" +
   "<button>Click to Add Highlight</button>" +
   "<scr"+"ipt type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js'></scr"+"ipt>" +
   " <scr"+"ipt type='text/javascript'>" +
   " $(':button').click(function(){" +
   "  $('<div/>', {" +
   "   'class': 'highlight'," +
   "   css: {" +
   "    position:   'absolute'," +
   "    height:     '50px'," +
   "    width:      '50px'," +
   "    left:       '200px'," +
   "    top:        '200px'," +
   "    background: '#fff'," +
   "    opacity:    0.5," +
   "    zIndex:     99" +
   "   }" +
   "  }).appendTo( $(window.opener.document.body) );" +
   " })" +
   " </scr"+"ipt>";
  var w = window.open('','highlighter','toolbar=0,location=0,status=0,width=200,height=100,scrollbars=1,resizable=1');
  w.document.write(highlight);
  w.document.close();
 })
})
</script>

I have also tried to use appendChild without success. I ultimately found this method to work, but it is a horrible solution and causes the page to blink.

if ($.browser.msie){
 var d = '<div class="highlight" style="position:absolute;height:50px;' +
  'width:50px;left:200px;top:200px;background:#fff;opacity:0.5;' +
  'filter:alpha(opacity=50);zIndex:99;"></div>';
 window.opener.document.body.innerHTML = window.opener.document.body.innerHTML + d;
}

Anyone know of a better solution?

  • 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. Editorial Team
    Editorial Team
    2026-05-13T21:12:19+00:00Added an answer on May 13, 2026 at 9:12 pm

    I think I found the problem. It might be a jQuery bug, but I can’t tell… I’ll post another question to get help.

    So I found the solution to this problem by just appending a string. For some reason jQuery in IE won’t append an object. So this works:

    if ($.browser.msie){
     var d = '<div class="highlight" style="position:absolute;height:50px;width:50px;left:200px;' + 
      'top:200px;background:#fff;opacity:0.5;filter:alpha(opacity=50);zIndex:99;"></div>';
     $(window.opener.document.body).append(d);
    }
    

    Edit: Pointy solved my problem in another question. It turns out it’s not a bug, but IE not allowing you to append an object created outside of the window. His solutions is as follows:

    window.opener.$('<div/>', {
     'class': 'highlight',
     css: {
      position:   'absolute',
      height:     '50px',
      width:      '50px',
      left:       '200px',
      top:        '200px',
      background: '#fff',
      opacity:    0.5,
      zIndex:     99
     }
    }
    

    But make sure the window.opener is using jQuery v1.4 or greater.

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

Sidebar

Related Questions

I have the following script, which works fine in Chrome but not in IE8:
I have the following script which works well: $(that).parents(.portlet).fadeOut('slow', function() { $(that).parents(.portlet).remove(); }); It
I have the following code that works fine in IE: <HTML> <BODY> <script language=JavaScript>
I have the following script which works fairly well: $(.btnMinimize).live('click', function(event) { event.preventDefault(); $(
I have a problem in my script but I am not sure why it
I have following script that executes all the .reg files in the current directory.
I have the following script that changes my image on a timer: var da
I have the following script that successfully retrieves the current track and updates my
I have the following script that runs when a user clicks a link that
I have the following simple python test script that uses Suds to call a

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.