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

loading iframe dynamically

hello,

how do you load an iframe dynamically? I don't mean url inside iframe,
but iframe itself..

thank you..
Aug 11 '06 #1
5 6834

maya wrote:
hello,

how do you load an iframe dynamically? I don't mean url inside iframe,
but iframe itself..

thank you..
You need the DOM
http://www.w3schools.com/htmldom/default.asp

var iframe = document.createElement( 'IFRAME' );
iframe.with = '300';
iframe.height = '400';
iframe.src = 'http://www.google.com'

document.body.appendChild( iframe );

Aug 11 '06 #2
bobzimuta wrote:
maya wrote:
>hello,

how do you load an iframe dynamically? I don't mean url inside iframe,
but iframe itself..

thank you..

You need the DOM
http://www.w3schools.com/htmldom/default.asp

var iframe = document.createElement( 'IFRAME' );
iframe.with = '300';
iframe.height = '400';
iframe.src = 'http://www.google.com'

document.body.appendChild( iframe );
thank you!! I knew there had to be a way.....:)
(I had looked in W3C DOM ref.. found iframe obj but no "name" or "id"
property, so wasn't sure how to do it..)

thanks again...

-m
Aug 11 '06 #3
maya wrote:
thank you!! I knew there had to be a way.....:)
(I had looked in W3C DOM ref.. found iframe obj but no "name" or "id"
property, so wasn't sure how to do it..)

thanks again...

-m
The standard attributes (id, src, class, etc.) can be modified (if not
readonly) via foo.bar = moo. If you want to assign special attributes,
use foo.setAttribute( 'name', 'value' );

Aug 11 '06 #4
bobzimuta said the following on 8/11/2006 12:51 AM:
maya wrote:
>thank you!! I knew there had to be a way.....:)
(I had looked in W3C DOM ref.. found iframe obj but no "name" or "id"
property, so wasn't sure how to do it..)

thanks again...

-m

The standard attributes (id, src, class, etc.) can be modified (if not
readonly) via foo.bar = moo. If you want to assign special attributes,
use foo.setAttribute( 'name', 'value' );
What makes you think that? setAttribute is known to be buggy in IE (not
necessarily with IFrames though) so the more you stay away from it - as
habit - the less your chances of running into problems.

foo.name = value;

is better than:

foo.setAttribute('name','value')

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 11 '06 #5
bobzimuta wrote:
maya wrote:
>thank you!! I knew there had to be a way.....:)
(I had looked in W3C DOM ref.. found iframe obj but no
"name" or "id" property, so wasn't sure how to do it..)

thanks again...

The standard attributes (id, src, class, etc.) can be
modified (if not readonly) via foo.bar = moo. ...
However, the src property as defined by the W3C Level 2 DOM
specification holds the value of the "initial frame contents" of the
IFRAME, so the consequences of assigning values to that that property
are extremely questionable and do not necessarily include any
consequential navigation of the IFRAME away from its current URL.

Once and IFRAME had been created the reliable method of navigating its
contents is to assign values to the - location - priority of its
corresponding window/global object.

Richard.

Aug 11 '06 #6

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

Similar topics

3
by: John Chen | last post by:
I need to use iframe to create a floating frame. But the contents in the iframe is not a external html file. Rather, it will be dynamically created by jsp. How can I set the src attribute to a URL...
4
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I...
10
by: Randy Webb | last post by:
This page: http://www.hikksworld.com/loadJSFiles/ Is one where I was testing the ability of browsers that can/can't dynamically load a JS file with one of the three methods: 1)Changing the src...
1
by: Dave | last post by:
Hi, We have documents on a file share that we want to load into an iframe when the page loads AND without the File Download dialog box appearing. I've managed to accomplish this with pdfs by...
5
by: Angel | last post by:
Is there a way to create an IFRAME dynamically via VB.NET. In other words creating the HTML element in the server side code? thanks in advance....
5
by: Tudor Tihan | last post by:
Hi, This is my first post here, so please be kind. I have tryed to make a javascript html page loader by using an invisible <IFrame> and some javascript variable text passing between...
1
by: spallared | last post by:
Hi, i've an IMG inside a DIV that should contains an image dynamically generated by a servlet as result of a form's action (image is sent to the browser as mime type image/png). I can't figure...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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
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
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...

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.