473,473 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problem with JavaScript in IE

I have been trying to copy a DIV in an IFRAME to the TOP DOCUMENT.

The code does the following

iframeDIV = document.getElementById('div_in_iframe');

var clonedDIV = iframeDIV.cloneNode(true);
It then sets various attributes of clonedDIV.

The last thing it does is:

top.document.body.appendChild(clonedDIV);
This works in FF and Safari but it fails in IE. IE doesn't seem to
like the last statement. Why?

--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)COM

"Well my son, life is like a beanstalk, isn't it?"
Jun 18 '07 #1
4 2923
if (nodes[j].outerHTML.indexOf('IFRAME') == -1){

control = nodes[j].cloneNode(true);

}

else {

control = nodes[j].cloneNode(false);

control.insertAdjacentHTML('afterBegin', nodes[j].innerHTML);

}

<VAXman- @SendSpamHere.ORGwrote in message
news:fr*************@newsfe12.lga...
>I have been trying to copy a DIV in an IFRAME to the TOP DOCUMENT.

The code does the following

iframeDIV = document.getElementById('div_in_iframe');

var clonedDIV = iframeDIV.cloneNode(true);
It then sets various attributes of clonedDIV.

The last thing it does is:

top.document.body.appendChild(clonedDIV);
This works in FF and Safari but it fails in IE. IE doesn't seem to
like the last statement. Why?

--
VAXman- A Bored Certified VMS Kernel Mode Hacker
VAXman(at)TMESIS(dot)COM

"Well my son, life is like a beanstalk, isn't it?"

Jun 18 '07 #2
In article <f5***********@news.isd.dp.ua>, "Dmitry Kulinich" <dk**@isd.dp.uawrites:
>

if (nodes[j].outerHTML.indexOf('IFRAME') == -1){

control = nodes[j].cloneNode(true);

}

else {

control = nodes[j].cloneNode(false);

control.insertAdjacentHTML('afterBegin', nodes[j].innerHTML);

}

<VAXman- @SendSpamHere.ORGwrote in message
news:fr*************@newsfe12.lga...
>>I have been trying to copy a DIV in an IFRAME to the TOP DOCUMENT.

The code does the following

iframeDIV = document.getElementById('div_in_iframe');

var clonedDIV = iframeDIV.cloneNode(true);
It then sets various attributes of clonedDIV.

The last thing it does is:

top.document.body.appendChild(clonedDIV);
This works in FF and Safari but it fails in IE. IE doesn't seem to
like the last statement. Why?
Could you explain this code you've provided and how I would insert it
in place of the top.document.body.appendChild(clonedDIV); in my code.

BTW, I found that using parent instead of top made M$IE happier. I no
longer get M$IE coughing up an error on the

parent.document.body.appendChild(clonedDIV);

but it still doesn't display the clonedDIV.
--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)COM

"Well my son, life is like a beanstalk, isn't it?"
Jun 18 '07 #3
On Jun 19, 1:36 am, "Dmitry Kulinich" <d...@isd.dp.uawrote:

Please don't top-post, reply below trimmed quotes. Posting order
restored.
<VAXman- @SendSpamHere.ORGwrote in message
news:fr*************@newsfe12.lga...
I have been trying to copy a DIV in an IFRAME to the TOP DOCUMENT.
The code does the following
iframeDIV = document.getElementById('div_in_iframe');
var clonedDIV = iframeDIV.cloneNode(true);
It then sets various attributes of clonedDIV.
The last thing it does is:
top.document.body.appendChild(clonedDIV);
This works in FF and Safari but it fails in IE. IE doesn't seem to
like the last statement. Why?

if (nodes[j].outerHTML.indexOf('IFRAME') == -1){
Given that a good many browsers don't support IE's proprietary
outerHTML property, test for support before attempting to use it.

>
control = nodes[j].cloneNode(true);

}

else {

control = nodes[j].cloneNode(false);

control.insertAdjacentHTML('afterBegin', nodes[j].innerHTML);
The same for insertAdjacentHTML.
--
Rob

Jun 18 '07 #4
In article <3D**************@newsfe12.lga>, VAXman- @SendSpamHere.ORG writes:
>{...snip..}
Could you explain this code you've provided and how I would insert it
in place of the top.document.body.appendChild(clonedDIV); in my code.

BTW, I found that using parent instead of top made M$IE happier. I no
longer get M$IE coughing up an error on the

parent.document.body.appendChild(clonedDIV);

but it still doesn't display the clonedDIV.
Nevermind. I figured it out. Stupid typo when I went to follow the
suggested code. Strangely, I'd looked many of the things referenced
but decided code up the page and then go back later for M$IE support.

--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)COM

"Well my son, life is like a beanstalk, isn't it?"
Jun 19 '07 #5

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

Similar topics

7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
4
by: Federico Bari | last post by:
Good morning all from italy, i have probably a compatibility problem with a html/javascript page. The aim of the code of the file test.htm you find here following (copy the 3 files in the...
1
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function...
4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
1
by: Julius Mong | last post by:
Dear all, according to the ASV3 manual known problem section, to make an <a> execute some Javascript onclick: ...
12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
0
by: Thomas Due | last post by:
Hello, I am in the process of making my asp.net form to validate as xhtml 1.0 strict. So far I am doing well, but now I have a problem. The problem concerns specifically DropDownList and...
1
by: mostafahamdyfcis | last post by:
Hello all I have used the sample code which exist in the following URL: http://www.eggheadcafe.com/articles/javascript_modal_dialog.asp which create modal dialog box, but some problem...
4
by: r_ahimsa_m | last post by:
Hello, I am learning WWW technologies in Linux. I created index.html file which I can browse with Firefox/Konqueror using URL localhost/~robert/rozgloszenia/index.html. The page looks fine but...
1
by: paulyXvpf | last post by:
Hello javascript folks, PROBLEM: Javascript dropdown problem in IE 6 and IE7 DESCRIPTION: menu falls behind a container box on web page COMMENTS: It works fine in Firefox but not in IE 6/7...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.