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

Sending html data to the IFrame contents

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 of a dynamically created
html contents rather than a static html file. Thanks.

Jul 20 '05 #1
3 10137
> 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 of a dynamically created
html contents rather than a static html file. Thanks.


Your notion of dynamic and static in this case is strictly on the server's side.
All the browser knows is that it gets a wad of html via http. All such wads are
provided in response to the browser sending a url in an http request. The shape
of that url depends on the application running in the appserver.

Jul 20 '05 #2
DU
John Chen wrote:
I need to use iframe to create a floating frame.
I do not understand what you mean with "floating" frame.
An url of your current webpage would have been useful here.

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 of a dynamically created
html contents rather than a static html file.


Not sure I understand correctly your question.
You can use DOM 2 methods to create a chunk of html code (or even
document fragment) and then insert it (almost anywhere, at any place)
into the iframed document. Or append it. Or replace current html content
of the iframe. Whatever you do, the src attribute value of the iframe
should not change.

E.g.: appending a div in a iframe from its own parent file

<script type="text/javascript">
function appendDivInIframedDocument()
{
var DOMdiv = frames["IframeName"].document.createElement("div");
DOMdiv.style.color = "green";
var DOMspan = frames["IframeName"].document.createElement("span");
DOMspan.style.color = "red";
var DOMspantext = frames["IframeName"].document.createTextNode("This is
the text node value of the span and it is red");
DOMspan.appendChild(DOMspantext);
DOMdiv.appendChild(DOMspan);
var DOMdivtext = frames["IframeName"].document.createTextNode(" while
this green text is part of the div text node. The green and red text
were dynamically inserted in the iframed document.");
DOMdiv.appendChild(DOMdivtext);
frames["IframeName"].document.body.insertBefore(DOMdiv,
frames["IframeName"].document.body.childNodes[1]);
document.getElementById("ButtonCreateAndInsert").d isabled = true;
}
</script>
</head>

<body>

<iframe src="OriginalDocumentIframe.html" name="IframeName" width="500"
height="200" style="border:3px solid blue;">[Your user agent does not
support iframes or is currently configured not to display iframes. If
you're using Opera 6+, you can enable iframe with
File/Preferences...Alt+P/Page style/Enable inline frames.]</iframe>

<p><button type="button" id="ButtonCreateAndInsert"
onclick="appendDivInIframedDocument();">Create and insert a div into the
Iframe document</button></p>

(...)

Works in MSIE 6 for Windows, Opera 7, Mozilla-based browsers, NS 7.1,
etc.. and in other DOM 2 compliant browsers as long as the markup code
syntax is valid.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #3
In article <t9q9b.468155$uu5.81229@sccrnsc04>,
"John Chen" <jo*******@comcast.net> wrote:
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 of a dynamically created
html contents rather than a static html file. Thanks.


There's no difference. Just write the URL for the JSP as
you would an HTML file. The browser just sends the URL
to the server and displays in the frame whatever
the server returns.
Jul 20 '05 #4

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

Similar topics

11
by: alex | last post by:
Hi, I am looking for a way to populate an HTML table from an external local text file which looks like this: DATE/TIME LAT. LON. DEPTH. ML....
1
by: Reply Via Newsgroup | last post by:
Folks, I have a cell in a table that has an IFRAME - The IFRAME is empty (ie it has no source tag) but it does have a name (myFrame) and id (also called myFrame). I can write data to the...
5
by: Victor | last post by:
Hi I need to open an html file from the file system and embed that html file within my main aspx form. I have 2 questions: 1) How do I open the html file? I tried the File.open(Path, mode) didnt...
4
by: Ed | last post by:
I am building a glossary. Each letter of the alphabet has its own HTML page, and each glossary entry on the page already has a unique HTML anchor tag immediately to the left of it. I've already...
5
by: vanisathish | last post by:
Hi All, I need to constantly update some values to the User Interface. In order to do the updation efficiently, i am planning to run some script in the server side that constantly keeps sending...
3
by: news | last post by:
I am trying to get at the source of a web page. Looking at the innerHTML element is only part of the story. In IE, right-clicking on various different parts of the page gives me different results...
1
by: acemtp | last post by:
Hello, Do you know a dynamic way to send 10kb of text or more using an iframe? I tried to do that with by creating, in javascript, a dynamic iframe, then create a form into this iframe and put...
1
by: rissaofthesaiyajin | last post by:
I have a page with an iframe, and a Javascript function that I need to get the contents of the iframe - what I mean by that is, the text from the list.html file that's in the iframe. It's actually a...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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
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...

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.