473,408 Members | 2,113 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,408 software developers and data experts.

add 'name' to dynamically created iframe

If I do this:

el = document.createElement("iframe");
el.src = "test.htm";
el.name = "frm"; // or el.setAttribute("name","frm");
document.body.appendChild(el);

the iframe gets created but the 'name' attribute is not added under IE
6. I tried setting the 'name' after appending the iframe but still no joy.

How can I add a 'name' attribute to an iframe so that IE 6 sees it?

Andrew Poulos
Nov 1 '06 #1
1 3203

Andrew Poulos wrote:
If I do this:

el = document.createElement("iframe");
el.src = "test.htm";
el.name = "frm"; // or el.setAttribute("name","frm");
document.body.appendChild(el);

the iframe gets created but the 'name' attribute is not added under IE
6. I tried setting the 'name' after appending the iframe but still no joy.

How can I add a 'name' attribute to an iframe so that IE 6 sees it?
Add the iFrame to the innerHTML of some other element, say a div.

<div id="xx"></div>
<button
onclick="alert(document.getElementsByName('ifrm')[0].name);">
Show ifrm
</button>
<script type="text/javascript">

document.getElementById('xx').innerHTML =
'<iframe name="ifrm" src="http://www.google.com/"></iframe>';

</script>
--
Rob

Nov 1 '06 #2

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

Similar topics

1
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...
1
by: Malkalypse | last post by:
Hello, I have been having some trouble with this one, so I decided to strip it down to its simplest form. I think I found the root of the problem, but I don't know how to solve it. I need a link...
7
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+...
5
by: Audrius | last post by:
Hello, Firstly, I'm not good at JS, so please be patient :) I have a quite complicated page structure, where a lot of frames are created dynamically (same applies to their names). How can I...
3
by: Quentin | last post by:
Hey there ! I made my own WebControl, that inherits from WebControls, and i added an HtmlTable to it. I would like to include a file, dynamically, to one of its cells... I've already searched,...
5
by: maya | last post by:
hello, how do you load an iframe dynamically? I don't mean url inside iframe, but iframe itself.. thank you..
1
by: Jeremy | last post by:
Hi, I am attempting to load an ad Banner to coincide with a piece of video pre-roll. The following function is called which is supposed to create an empty IFRAME. Once this IFRAME object is...
3
by: synergy_711 | last post by:
I feel like this should be fairly easy but I have been struggling with this for sometime. I have not been able to find someone who's had the same problem as mine yet. ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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,...
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...

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.