473,396 Members | 1,706 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,396 software developers and data experts.

how to appendChild to iframes

var iframe = document.createElement("<IFRAME id='frame0' style='PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px' border='no' name='frame0' src='RasteriserServlet?width=200&amp;height=200&am p;bgColor=#FFFFFF&amp;fgColor=#000000' frameBorder='no' width='200' scrolling='no' height='200' menuId='formControlPopup' childName='frame' showLable='true' labelPosition='bottom'>");

var form = document.createElement("<FORM action='RasteriserServlet?' name='form0' childName='form' method='Post' id='form0'>");
iframe.appendChild(form);

or

iframe.insertBefore(form);
doesn't works "Unexpected call to method or property access."

So,
how to appendChild to iframes?


--
Thank you,
De Cool,
EPE
Jun 21 '07 #1
1 17469
On Jun 21, 1:07 pm, "Dmitry Kulinich" <d...@isd.dp.uawrote:
var iframe = document.createElement("<IFRAME id='frame0' style='PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px' border='no' name='frame0' src='RasteriserServlet?width=200&amp;height=200&am p;bgColor=#FFFFFF&amp;fgColor=#000000' frameBorder='no' width='200' scrolling='no' height='200' menuId='formControlPopup' childName='frame' showLable='true' labelPosition='bottom'>");

var form = document.createElement("<FORM action='RasteriserServlet?' name='form0' childName='form' method='Post' id='form0'>");

iframe.appendChild(form);

or

iframe.insertBefore(form);
doesn't works "Unexpected call to method or property access."

So,
how to appendChild to iframes?

--
Thank you,
De Cool,
EPE
Several issues:
To my knowledge, you can't create elements with

var td = document.createElement( "<td id='bla' width='100%'>" );

but with

var td = document.createElement( "td" );
td.setAttribute( "id", "bla" );
td.setAttribute( "width", "100%" );
etc.

Now, I used TD as an illustration, it should of course refer to the
iframes as well. Maybe there's some part of DOM that parses the
strings in the fashion you used them, but I'm not familiar with that.

Second, iframes are actually a form of windows, not DOM nodes, that in
themselves container documentElement and documentElement in its self
contains Elements. So, what you should do is find the iframe's
contentWindow, then its document element, and then you can find the
'body' element of the document; then you can append children to the
latter.

So, what you should probably do is something like this: (not tested,
but just pointing the direction)

var iframe = document.createElement("IFRAME" );
iframe.id = 'frame0';
iframe.setAttribute( "style", 'PADDING-RIGHT: 0px; PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px; PADDING-TOP: 0px'" );
iframe.setAttribute( "border, 'no' );
iframe.setAttribute( "name", 'frame0' );
iframe.setAttribute( "src", 'RasteriserServlet?
width=200&amp;height=200&amp;bgColor=#FFFFFF&amp;f gColor=#000000' );
iframe.setAttribute( "frameBorder", 'no' );
.....

var form = document.createElement( "FORM" );
form.setAttribute( "action", 'RasteriserServlet?' );
form.setAttribute( "name", 'form0' );
.....

iframe.contentWindow.document.body.appendChild( form );

I don't know if this is going to work though, cause just creating the
"iframe" element shouldn't create all of its necessary children I
named above, such as contentWindow, its corresponding document, body,
etc. elements.
So, maybe, the thing you're doing maybe isn't the best idea in the
very root of its concept?

Jun 21 '07 #2

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

Similar topics

10
by: maxim vexler | last post by:
I'm reading a lot of talks lately about the term iFrame and with your permission would like to ask a few question about that : - what is iFrame, i mean what is it good for ? - does all the...
0
by: Dan Popa | last post by:
Check out the following 2 links: http://www.batisdev.com/admin/test_1images.asp http://www.batisdev.com/admin/test_2images.asp First page contain 4 IFRAMES and 1 IMG tags. Second page contain 4...
25
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to...
2
by: samuel.adam | last post by:
Hi all, I am coding an AJAX DHTML whatever application and I was fed up with always typing a lot of appendChild() functions. I created a custom one called append_children() and wanted to share...
2
by: Guadala Harry | last post by:
1. Are IFrames supported only in uplevel versions of IE? If not IE exclusively, what browsers support IFrames? 2. Are IFrames going to be supported in the future - as far as anyone knows - or...
3
by: Giggle Girl | last post by:
Is there a way to use Javascript to detect if a browser supports IFrames, or (if it DOES support them) that IFrame use is enabled? Thanks, Ann
19
by: wmanzo | last post by:
I have a really professional conspiracy movie site and I use tons of layers and an external scroll bar assembly. I would like to put the various sections into MS Iframes and in order to clean up...
2
by: ericisjusteric | last post by:
I have a page with multiple iframes and need to have the user (ie6) be able to click a button to refresh any one of the iframes - but also to click another button at the top of the page to refresh...
2
by: vsanjit | last post by:
Hi all, I've been trying to create a table dynamically upon the generation of en event using the appendChild method in Javascript. This seems to work fine in Firefox, but not in IE7. There's also...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.