I am trying to change the display for some elements in an iframe
eg:
the iframe has the following link
<a href="" onclick="window.parent.document.getElementById('element').style.display = 'none'">

however it does not seem to be working, I am trying to figure out is there a way to do this.

an iframe contains a full html file
at minimum <iframe src='file'>alternate text</iframe> rambling on, as thoughts just wander, try <a href="" onclick="window.top.document.getElementById('element').style.display = 'none'"> as there may be other elements in the document tree(?), not just the immediate parent

I am trying to change the display for some elements in an iframe
eg:
the iframe has the following link
<a href="" onclick="window.parent.document.getElementById('element').style.display = 'none'">

however it does not seem to be working, I am trying to figure out is there a way to do this.

Your question is kinda blurry.

You are saying: "I am trying to change the display for some elements in an iframe" with: "<a href="" onclick="window.parent.document.getElementById('element').style.display = 'none'">"

Than, why on earth are you calling its parent(?!!).
-you can't make a pair from two left leg shoes.

You are either trying to change the display property of an element on an iframe from link residing on the parent, or from the link in the iframe to some element in the parent.

But your question is no go, -it's overruling them both.
1] You are saying "I am trying to change the display for some elements in an iframe"; pointing out that the: "some elements" are a part of the iframe. And
2] "the iframe has the following link", meaning that the mentioned link is on an iframe!

Therefore there is no question to answer...
Can you please be more specific?
Why don't you delete the red part of your onclick event declaration on that link... and see if it does the thing you think you asked first :D.

Troy a little bit of common sense versus proving you can type goes a long way in these forums.

People don't come to these forums to hear individuals with less than fulfilled lives attempt to berate them but rather to learn as the human condition mandates none of us are perfect.

I am on quite a few forums and offer expert advice on networking OS and application server issues and no matter the question I know it is being asked because someone "desires" to learn not to be berated.

In a nutshell you are making no sense you. Here is a bombshell for you, a page can hold "multiple" iframes so yes I can be trying to change some elements in an iframe (not necessarily the one the links are in)
and the link can be in an iframe (not necessarily the one I am trying to update)

So when you feel a need to try to make someone look stupid take a long hard look in the mirror and read before you post to ensure you don't end up adorning yourself with the robes of stupidity you intended for someone else.

Thank you Almostbob worked perfectly I just failed to remember to change my base href when I uploaded to the server so the cross domain security issue had prevented the change.

oh, thanks for your reply, a respected member of this forum has a signature like this:

"50% of the solution lies in accurately describing the problem!"
Airshow

It can happen to me too! Therefore my question was: "Can you please be more specific?"
But anyway I'm glad you solved it, but I'm sorry for being that dumb to not understand your question the way you wrote it, I'm not that perfect either.

Regards.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.