473,763 Members | 2,930 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 6624
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
47343
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
24648
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
4866
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
6682
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
2557
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
3858
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
9563
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
9383
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9992
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...
1
9935
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9819
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...
1
7364
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5268
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...
3
3519
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2790
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.