views:

44

answers:

4

Hi, I can successfully fire a click event in a button on a parent window from a popup in FF and Chrome... however nothing happens in IE. Any ideas?

window.opener.document.getElementById(Client ID Of Button).click();
A: 

I think in IE you should write: "self.opener"

I guess the problem is in the window.open function which opened this popup, make sure that there are no spaces in the page name and window name.

Amr ElGarhy
Hmmm... I gave this a go, but unfortunately it didn't work.
Paul
A: 

I would think that would work but note: the elementID should be in quotes and the dom specifies that the event lives in onClick()

window.opener.document.getElementById("Client ID Of Button").onClick();

You could also use self.opener

or window.parent or self.parent

Hopefully these Ideas help

John Hartsock
Thanks for the advice, but unfortunately neither of these options worked in IE, and many stopped working in FF and Chrome.
Paul
perhaps we could see more of the source?
John Hartsock
A: 

this works in FF $(parent.document.getElementById('clientId')).trigger('click');

lakhlaniprashant.blogspot.com
Indeed it does, but it needs to work in Internet Explorer as well :)
Paul
ok I've never tested it in IE but you will need two versions, but all you need to do is .trigger('click') which should be corrected in your code
lakhlaniprashant.blogspot.com
A: 

The standard answer here in normal GUI-based code is to say that if you have your .click event call a named method, and have all of your actual code inside that method, then it is much easier to have the external object call that named method than it is to have it try and fire a click event.

Don't know how well this applies to your javascript problem, as it's not my field, but as far as I'm concerned, unless you have a deep and deliberate need to actually have a button be pressed, it's far simpler to call a method.

Frosty840
Lol, I totally agree, however I'm resorting to this approach because I can't otherwise activate the required parent method from the popup.
Paul