473,770 Members | 4,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Whta's the Story with document.create Element('iframe ') in IE?

It is recommended by some sources I found to create IFrames in IE
using
document.create Element('<ifram e src="#">')
instead of document.create Element('iframe ').
Why and what browser versions to use it? IE5 or IE6?
Thanks
Sep 9 '08
23 6632
The Magpie wrote:
vunet wrote:
>With my original question I was hoping to hear what experts think if
they are familiar with what I am asking.

Experts are suggesting that using <iframeis basically a bad idea
unless you have some over-riding reason that you need to use it. In
virtually all cases, there will be no such reason.
Hear, hear!
PointedEars, amused
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Sep 10 '08 #21
On Sep 10, 6:41*pm, Henry <rcornf...@rain drop.co.ukwrote :
On Sep 9, 10:12 pm, vunet wrote:
In IE6 and IE7, if you have to use the name attribute of
a dynamic element inserted into the document, you *must*
declare the name attribute of the element when calling
document.create Element(). After is too late.
in IE6 and IE7 :
var input = document.create Element('<input name="myInput"> ');
var iframe = document.create Element('<ifram e name="myIframe" >');
Anywhere else :
var input = document.create Element('input' );
input.name = 'myInput';
var iframe = document.create Element('iframe ');
iframe.name = 'myIframe';
Is this the answer I was looking for? Thanks Laurent, I've
been through all this dirt from other 'experts' but finally
got what I need.

If you were only interested in listening to the answer you wanted to
hear, rather than learning the truth, why did you ask the question in
the first place? You knew the answer you wanted to hear from the
outset, so you were just wasting everyone's time asking the question
in a forum that would rather promote understanding stupid mystical
incantations.
The answer he was looking for was really the *official* reason why the
stupid mystical incantation in necessary in the first place which
Laurent correctly gave:

http://msdn.microsoft.com/en-us/library/ms536389.aspx

He had to ask in the newsgroup in the first place because he wasn't
even sure there IS an official reason for it much less where to LOOK
FOR IT.

So the question WAS warranted (it's not in the FAQ after all). By the
way, this so called stupid mystical incantation is necessary in IE for
other things besides iframes. It's necessary for selects, inputs and
textareas. It may be necessary for other tags as well but I've mostly
found problems with form elements. Basically, document.create Element
is b0rk in IE.
Sep 10 '08 #22
slebetman wrote:
On Sep 10, 6:41 pm, Henry <rcornf...@rain drop.co.ukwrote :
>On Sep 9, 10:12 pm, vunet wrote:
>>>In IE6 and IE7, if you have to use the name attribute of
a dynamic element inserted into the document, you *must*
declare the name attribute of the element when calling
document.cre ateElement(). After is too late.
in IE6 and IE7 :
var input = document.create Element('<input name="myInput"> ');
var iframe = document.create Element('<ifram e name="myIframe" >');
Anywhere else :
var input = document.create Element('input' );
input.name = 'myInput';
var iframe = document.create Element('iframe ');
iframe.nam e = 'myIframe';
Is this the answer I was looking for? Thanks Laurent, I've
been through all this dirt from other 'experts' but finally
got what I need.
If you were only interested in listening to the answer you wanted to
hear, rather than learning the truth, why did you ask the question in
the first place? You knew the answer you wanted to hear from the
outset, so you were just wasting everyone's time asking the question
in a forum that would rather promote understanding stupid mystical
incantations .

The answer he was looking for was really the *official* reason why the
stupid mystical incantation in necessary in the first place
Nonsense. Read the OP again.
which Laurent correctly gave:

http://msdn.microsoft.com/en-us/library/ms536389.aspx
That may be what you consider official, but it is nonsense nonetheless.
Turns out the vendor does not even know its own product or is incapable
of expressing its flaws properly in the documentation.
He had to ask in the newsgroup in the first place because he wasn't
even sure there IS an official reason for it much less where to LOOK
FOR IT.
This "official reason" excuse is a byproduct of your vivid imagination. The
OP asked why it was done this way, and the correct answer is that the author
of the code had no clue what they were doing. Because a reasonable
developer double-checks everything that he reads.
So the question WAS warranted (it's not in the FAQ after all).
There is no doubt about that. However, that the OP assumed that what he
read was the only correct way because a million flies already said so, was
presumptuous and turned out to be wrong.
By the way, this so called stupid mystical incantation is necessary in IE for
other things besides iframes. It's necessary for selects, inputs and
textareas. It may be necessary for other tags as well but I've mostly
found problems with form elements. Basically, document.create Element
is b0rk in IE.
You have not read or tested "Henry"'s code, have you?
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Sep 11 '08 #23
On Sep 10, 11:36 pm, slebetman wrote:
On Sep 10, 6:41 pm, Henry wrote:
>On Sep 9, 10:12 pm, vunet wrote:
>>>In IE6 and IE7, if you have to use the name attribute of
a dynamic element inserted into the document, you *must*
declare the name attribute of the element when calling
document.cre ateElement(). After is too late.
>>>in IE6 and IE7 :
var input = document.create Element('<input name="myInput"> ');
var iframe = document.create Element('<ifram e name="myIframe" >');
>>>Anywhere else :
var input = document.create Element('input' );
input.name = 'myInput';
var iframe = document.create Element('iframe ');
iframe.nam e = 'myIframe';
>>Is this the answer I was looking for? Thanks Laurent, I've
been through all this dirt from other 'experts' but finally
got what I need.
>If you were only interested in listening to the answer you
wanted to hear, rather than learning the truth, why did you
ask the question in the first place? You knew the answer you
wanted to hear from the outset, so you were just wasting
everyone's time asking the question in a forum that would
rather promote understanding stupid mystical incantations.

The answer he was looking for was really the *official* reason
why the stupid mystical incantation in necessary in the first
place
The answer to that is that it is *not* necessarily. And that answer
was given, but apparently that answer, no matter its demonstrable
truth, was not the answer he was looking for.
which Laurent correctly gave:
<snip>

You cannot "correctly" give a reason for the necessity of something
that is not necessary.
He had to ask in the newsgroup in the first place because
he wasn't even sure there IS an official reason for it
But he was not interested in listening when he was told that there was
not.
much less where to LOOK FOR IT.
There can be no "where to look" for the reason for the necessity of
something that is not necessary.
So the question WAS warranted
Not if the answer was pre-determined by ill-conceived preconceptions.
(it's not in the FAQ after all).
Difficult to pot the absence of a reason for the necessity of
something into any document. But it any event it is a long way from
being a frequently asked question.
By the way, this so called stupid mystical incantation is
necessary in IE for other things besides iframes.
It is not necessary for IFRAMEs, and (unsurprisingly ) also unnecessary
for anything else.
It's necessary for selects, inputs and
textareas.
In what way? IE happily creates input, select and textarea elements
for me using DOM standard element creation code. (<input type="radio">
are the only elements that need special handling as a result of IE's
characteristics , and I still use non-branching code for those).
It may be necessary for other tags as well but I've mostly
found problems with form elements.
Your finding problems with the code you write is not, in itself, a
reason to be attributing issues to the wider world.
Basically, document.create Element
is b0rk in IE.
Based on what evidence? The case of targeting links and form
submission not being as simple as it could be has nothing to do with
the - createElement -, but rather is a consequence of employing -
setAttribute - and/or assigning to the element's - name - property not
having the side effect of associating a name with the corresponding
window object in IE. Thus if anything is broken it is the assignment
to the element's - name - property and/or - setAttribute -. And here
is a reflection of my point about the quality of analysis being so
poor that people fixate on mystical inactions that never do much more
that solve issues by coincidence; you are blaming the - createElement
- method, when with the argument "IFRAME" IE's - createElement -
method does no more and no less than any other - createElement -
method (creates a IFRAME element that is not attached to a document
and has no more than default/implied properties/attributes, and
certainly no name or id).
Sep 11 '08 #24

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

Similar topics

2
47344
by: Templar | last post by:
Hi i'm bothering with such problem... I must dynamic create an Iframe, and then put som raw HTML into it. But I can't. When I create iframe, I can't access its properties. Here's the coe snipplet: //************************************* //*************************************
1
24649
by: Martin | last post by:
There seems to be some strange behaviour when trying to get the scrollHeight and scrollTop of an iframe in IE6. I have tried several ways of getting these values when the iframe is written into the html. The following return the correct values in IE6, where the iframe's id is 'f': f.document.body.scrollHeight f.document.body.scrollTop window.frames.document.body.scrollHeight
7
4867
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+ doesn't seem to have the problem. I'm doing: this.iframe = document.createElement( 'iframe' ); this.iframe.id = this.id + 'wh'; this.iframe.style.display = 'none';
16
7117
by: Mcginkel | last post by:
I am trying to find a way to load XHTML content in an Iframe. I use to do this in html by using the following code : var iframeObject = document.createElement("iframe"); MyDiv.appendChild(iframeObject); var data = "<html><head><title>testing</title></head><body>data</body></html>" iframeObject.contentDocument.open(); iframeObject.contentDocument.writeln(data);
1
6683
by: jaktharkhan | last post by:
Hi, I really really need help in trying to figure out how can I do a CloneNode on an Iframe where the cloned IFRAME clones with all its contents?. Basically what I am doing is dynamically building a table with Iframes inside it. The problem is I just want to build one Iframe because the contents of it can be very complex. After my Iframe is built I just want to clone the iframe as many times as I need later. I cannot use an HTML file and...
4
2559
by: Drew | last post by:
This might beyond the scope of this group because it deals with SharePoint, but I'm not sure if I can't get it to work because of SharePoint or because JavaScript is weird (I don't have much experience with JavaScript). Anyway, here is the code i'm working with. Basically, it creates appends a hidden IFrame to the page, gets the links from the IFrame, and displays those which have the "OnLink" property. The weird thing is that when I...
10
3860
by: jon | last post by:
I'm trying to use a hidden iframe to print the contents of one div seamlessly. Currently I can create the hidden iframe, copy the contents of the div to the iframe, and print it. I even have a method that initially copies all the original page's styles onto the new iframe to maintain look and feel. So far things work, and the div (along with look and feel from styles) are successfully copied to the iframe and printing just the hidden...
1
5284
by: XP | last post by:
Hello Everyone, I was stuck with this really frustrating problem for sometime. Let me explain what I am trying to achieve: There is a form and an inner iframe. The form's target is set to the iframe so that when the form is submitted, the page does not get reloaded/changed ( as the iframe would be the one getting refreshed. The Iframe is set to have 0 width and height to make it look invisible ). I have a copied the html source ( at...
2
3281
riptide2049
by: riptide2049 | last post by:
I really have a problem here. I have a code that is suppost to take the href of a link from the right class;value of a link maked toreturn false. the value is a Media file the file is sent to quicktime or windows meida player depending on which plugin was found. after the plug in is found a iframe with the right player is created. here is the code. for some reason In IE the plug in doesnt work and in fire fox it crashes <!DOCTYPE html...
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10231
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9871
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8887
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6679
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3972
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 we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.