473,394 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

window.opener.getElementById('myDiv').innerHTML ... doesn't work!

Dear reader..
i have a page that opens a popup window
from this popup window i have to change some opener divs innerHTML
content,
how can i do?
this is how i do, (and it doens't work):

THE MAIN WINDOW:
<div id="'myDiv'"></div>
<input type="button"
onClick="MM_openBrWindow('test.htm','testWin','wid th=370,height=200')"
value="Open Test">
THE POPUP WINDOW (test.htm):
<script language=javascript>
window.opener.getElementById('myDiv').innerHTML='T EST SUCCEDED!!';
</script>

------------------------------------------------------------
how can i do to make it work?
thanks

Simone

Apr 13 '06 #1
11 39733
i tried also:
window.opener.document.getElementById('myDiv').inn erHTML='TEST
SUCCEDED!!';

but it doesn't work!

Apr 13 '06 #2

Giakko wrote:
<snip>
THE MAIN WINDOW:
<div id="'myDiv'"></div> <snip> ^
That apostrophe makes this ID different form the one you are trying to
look up.
window.opener.getElementById('myDiv').innerHTML='T EST SUCCEDED!!';


The - opener - is a window object and does not have a getelEmentById -
method. Use - opener.document.getElementById -.

Richard.

Apr 13 '06 #3

Richard Cornford wrote:
Giakko wrote:
<snip>
THE MAIN WINDOW:
<div id="'myDiv'"></div>

<snip> ^
That apostrophe makes this ID different form the one you are trying to
look up.
window.opener.getElementById('myDiv').innerHTML='T EST SUCCEDED!!';


The - opener - is a window object and does not have a getelEmentById -
method. Use - opener.document.getElementById -.

Richard.


also, innerHTML is IE only

Apr 13 '06 #4
Just so you know, innerHTML does work in Firefox (tested in 1.5) but is
becoming depreciated. They recommend you go through the W3C compliant
DOM methods instead. I don't know if I neccessarily agree with it, but
that is what they recommend.

Richard is right on all counts though. Just my two cents. :)

Apr 13 '06 #5
Ab*************@gmail.com said the following on 4/13/2006 4:37 PM:
Richard Cornford wrote:
Giakko wrote:
<snip>
THE MAIN WINDOW:
<div id="'myDiv'"></div>

<snip> ^
That apostrophe makes this ID different form the one you are trying to
look up.
window.opener.getElementById('myDiv').innerHTML='T EST SUCCEDED!!';

The - opener - is a window object and does not have a getelEmentById -
method. Use - opener.document.getElementById -.

Richard.


also, innerHTML is IE only


Who fed you that line of BS and how much did you pay for it? I have some
more BS like that if you are buying.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 13 '06 #6
Martyr2 wrote:
Just so you know, innerHTML does work in Firefox (tested in 1.5)
And Netscape, and Opera.
but is
becoming depreciated. They recommend you go through the W3C compliant
DOM methods instead. I don't know if I neccessarily agree with it, but
that is what they recommend.


If that's so, it's really a bad thing:
http://www.quirksmode.org/dom/innerhtml.html

innerHTML is about 3x faster than DOM methods in Mozilla 1.75, and 4x
faster in Opera 8.

Also, it's often much simpler from a coding standpoint.
Apr 13 '06 #7
Oh I know it is much easier from a coding standpoint. I just read on
the W3C site that they recommend avoiding innerHTML because it could
possibly introduce content into the dom structure that can not be
referenced later. Granted it is a working draft I read it from. The
exact phrase being...

Quote: "Assistive technologies such as screen readers rely on the
Document Object Model (DOM) to interpret the semantics in HTML for a
different modality. Given this, the document.write() and innerHTML()
methods can render content invalid (and inaccessible via DOM) after the
fact."

Does this mean never ever use it because it is bad? Bah, I would still
use it and I do use it regularly. It's all good. Just make sure you use
valid html structure and the DOM will be fine. But point well taken
Tony. :)

Apr 14 '06 #8
Martyr2 said the following on 4/13/2006 9:11 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
<URL: http://www.safalra.com/special/googlegroupsreply/ >
Oh I know it is much easier from a coding standpoint. I just read on
the W3C site that they recommend avoiding innerHTML because it could
possibly introduce content into the dom structure that can not be
referenced later. Granted it is a working draft I read it from. The
exact phrase being...
That isn't a flaw in innerHTML, it is a flaw in the ability of the
person using innerHTML.
Quote: "Assistive technologies such as screen readers rely on the
Document Object Model (DOM) to interpret the semantics in HTML for a
different modality. Given this, the document.write() and innerHTML()
methods can render content invalid (and inaccessible via DOM) after the
fact."


Screen Readers that can process JS and add structure to the DOM? WOW.
But, I never did care much for what the W3C has to say.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 14 '06 #9

Randy Webb wrote:
Martyr2 said the following on 4/13/2006 9:11 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
<URL: http://www.safalra.com/special/googlegroupsreply/ >
Oh I know it is much easier from a coding standpoint. I just read on
the W3C site that they recommend avoiding innerHTML because it could
possibly introduce content into the dom structure that can not be
referenced later. Granted it is a working draft I read it from. The
exact phrase being...
That isn't a flaw in innerHTML, it is a flaw in the ability of the
person using innerHTML.


I never said it was a flaw, it is just depreciated because of the
problems it could introduce if misused. Which I why I am guessing they
have not removed it from the firefox implementation.
Quote: "Assistive technologies such as screen readers rely on the
Document Object Model (DOM) to interpret the semantics in HTML for a
different modality. Given this, the document.write() and innerHTML()
methods can render content invalid (and inaccessible via DOM) after the
fact."


Screen Readers that can process JS and add structure to the DOM? WOW.
But, I never did care much for what the W3C has to say.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Apr 14 '06 #10
Martyr2 wrote:
Oh I know it is much easier from a coding standpoint. I just read on
the W3C site that they recommend avoiding innerHTML because it could
possibly introduce content into the dom structure that can not be
referenced later. Granted it is a working draft I read it from. The
exact phrase being...
Funny - I've never had a problem accessing content added by innerHTML
through the DOM
Quote: "Assistive technologies such as screen readers rely on the
Document Object Model (DOM) to interpret the semantics in HTML for a
different modality. Given this, the document.write() and innerHTML()
methods can render content invalid (and inaccessible via DOM) after the
fact."
"can render" - not "will render". It makes no sense to throw it out
because some people abuse it.

Some people abuse (<insert: pain medication/decongestant/spray
paint/etc.) - does that mean we get rid of (<insert: pain
medication/decongestant/spray paint/etc.)
Does this mean never ever use it because it is bad? Bah, I would still
use it and I do use it regularly. It's all good. Just make sure you use
valid html structure and the DOM will be fine.
Exactly.
But point well taken
Tony. :)


Thank you

Apr 14 '06 #11
Martyr2 said the following on 4/14/2006 12:36 AM:
Randy Webb wrote:
Martyr2 said the following on 4/13/2006 9:11 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
<URL: http://www.safalra.com/special/googlegroupsreply/ >
Oh I know it is much easier from a coding standpoint. I just read on
the W3C site that they recommend avoiding innerHTML because it could
possibly introduce content into the dom structure that can not be
referenced later. Granted it is a working draft I read it from. The
exact phrase being...

That isn't a flaw in innerHTML, it is a flaw in the ability of the
person using innerHTML.


I never said it was a flaw, it is just depreciated because of the
problems it could introduce if misused. Which I why I am guessing they
have not removed it from the firefox implementation.


My apologies if my thought's didn't come across right. It wasn't a
contradiction but more of an added thought to the conversation.

If people have problems using innerHTML (which is what they have) then
it isn't a problem with innerHTML itself but rather the people who use
it not having an understanding of what it does and doesn't do.

That problem (lack of understanding) is what leads people to cry
"innerHTML is broken" and then some standards body will try to
"deprecate it" because it is "broken" when what is really broken is the
knowledge level of people using it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 14 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: fogwolf | last post by:
First a basic outline of what I am trying to do: I want to have a page spawn a pop-up when you click "submit" on its form. On this pop-up page there will be another form. When you click "submit"...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
3
by: Steve Wark | last post by:
I have created a ASP.NET application and created two forms within the application (Webform1.aspx & Webform2.aspx). On the first form I have placed a textbox (TextBox1) and a button, which when...
7
by: MrFez | last post by:
Through some investigation it appears that selecting "Every visit to the page" for the IE caching setting "Check for new version of stored pages" causes the window.opener property of child windows...
3
by: alison | last post by:
I am trying to redirect the parent page when the user clicks an html button in an aspx page by using the javascript: window.opener.location.href="EditOrders.aspx"; This works fine on IE for...
4
by: Phil Powell | last post by:
I thought this would work but it seems to not work neither in Netscape nor in IE: <script type="text/javascript"> <!-- // OBTAINED FROM http://www.javascripter.net/faq/settinga.htm //...
3
by: jan | last post by:
I know Window.opener.refresh() does not work if two windows are from a different domain. Anyone a (javascript)-solution for this problem ? tks Jan/
5
by: asadhkhan | last post by:
I have the following code which works correctly in IE 6, but in IE 7, Fire Fox 2.0 and Netscape 8 it does not work. I have a main page where a button calls this pop-up and uploads a file once you...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.