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

Object tag to write HTML page to via JavaScript?

gsb
Object tag to write HTML page to via JavaScript?

I've used iFrames and Objects to load web pages into another page.
I want to do similar but not load a uri, rather write the page, <HTML>
....to...</HTML> via a JavaScript function.
Is this possible with either of these two tags?

Thanks,

gsb
Jul 20 '05 #1
13 2445
"gsb" <gs*@QWest.net> writes:
Object tag to write HTML page to via JavaScript?

I've used iFrames and Objects to load web pages into another page.
I want to do similar but not load a uri, rather write the page, <HTML>
...to...</HTML> via a JavaScript function.
Is this possible with either of these two tags?


Use an iframe.
---
<iframe id="foo" name="foo"></iframe>

<script type="text/javascript">
function writeDoc() {
var doc = frames['foo'].document;
doc.open();
doc.write("<!DOCTYPE ... ><html> ....funny content! </html>");
doc.close();
}
</script>
<input type="button" value="insert" onclick="writeDoc()">
---
Tested in IE 6, Mozilla FB and Opera 7.
Mozilla is the one that requires the name attribute on the iframe
in order to access it through the frames collection.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
gsb
Does that work with an object, or just an iFrame?

Thanks again,

gsb

"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:oe**********@hotpop.com...
"gsb" <gs*@QWest.net> writes:
Object tag to write HTML page to via JavaScript?

I've used iFrames and Objects to load web pages into another page.
I want to do similar but not load a uri, rather write the page, <HTML>
...to...</HTML> via a JavaScript function.
Is this possible with either of these two tags?
Use an iframe.
---
<iframe id="foo" name="foo"></iframe>

<script type="text/javascript">
function writeDoc() {
var doc = frames['foo'].document;
doc.open();
doc.write("<!DOCTYPE ... ><html> ....funny content! </html>");
doc.close();
}
</script>
<input type="button" value="insert" onclick="writeDoc()">
---
Tested in IE 6, Mozilla FB and Opera 7.
Mozilla is the one that requires the name attribute on the iframe
in order to access it through the frames collection.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors:

<URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html> 'Faith without judgement merely degrades the spirit divine.'

Jul 20 '05 #3
"gsb" <gs*@QWest.net> writes:

Please don't top post.
Does that work with an object, or just an iFrame?


Probably only with iframes. It accesses the document object
of the embedded page throught the frames collection.

I don't have much experience with objects, but my impression is
that pages embedded with the object tag are not easily accessible
through scripting - because the object can hold so many different
types of data, there is no simple way to access the data that is
there.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4
gsb
I appreciate your patience, but I'm not sure what "Please don't top post."
means.
Please explain. I apologies for my ignorance regarding the posting.

I like the simplicity of your solution, but it did not work in Netscape (I
have 7.1)
That is why I asked about the object tag.

Thanks,

gsb
"gsb" <gs*@QWest.net> wrote in message
news:Ci*****************@news.uswest.net...
Object tag to write HTML page to via JavaScript?

I've used iFrames and Objects to load web pages into another page.
I want to do similar but not load a uri, rather write the page, <HTML>
...to...</HTML> via a JavaScript function.
Is this possible with either of these two tags?

Thanks,

gsb

Jul 20 '05 #5
"gsb" <gs*@QWest.net> writes:
I appreciate your patience, but I'm not sure what "Please don't top
post." means. Please explain. I apologies for my ignorance
regarding the posting.
Top posting refers to the practice of putting ones entire reply at
the top of the message, and including the entire previous message
below. It is a bad idea for several reasons.

1) Readability. While this can ofcourse be argued, a majority of
newsgroup users prefer to see the context of a reply before the reply.
Splitting the replies to different parts of the previous message up,
also makes it easier to see which reply replies to which part.

2) Bandwidth. Including the entire previous message below is a waste
of bandwidth. While a single message won't kill anyone, not even
people reading news on a modem and paying by the minute, if two people
both use this quoting style in reply to each other, the quotes would
quickly become huge (each message including the *entire* history of
the discussion). It is recommended to quote only the parts of the
previous message that are needed to give context to your reply.
Keeping quotes from even earlier messages is rarely improtant,
and should be kept to a minimum.
(Not quoting anything is also bad, because you completely lose the
context).

3) Structure. The standard for messages specifies a separator between
the message and the signature (minus-minus-space on a line of its
own). Message readers recognize this divider, and treats the part
below it specially. By writing the reply at the top, the entire quoted
message now appears below the signature separator, which can be highly
confuzing to both people and newsclients. The only advantage is that
clients should cut the signature before replying, potentially avoiding
the extra quoting. Sadly, not all clients does this.

Thank you for asking :)
I like the simplicity of your solution, but it did not work in Netscape (I
have 7.1)
It works for me in Netscape 7.1 (freshly installed - damn them for
installing AOL without my permission!).
That is why I asked about the object tag.


Actually, in Netscape 7.1 it seems to work with object instead of iframe.
It doesn't in Opera or IE, though.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #6
gsb
Thank you for responding.
My internet express auto add that stuff in the reply.

Anyway, here's what I came up with:

function doWrite() {
var doc=null, obj=document.getElementById( "myID" );
if(obj.contentDocument) doc=obj.contentDocument;
else if(obj.contentWindow) doc=obj.contentWindow.document;
else if(obj.document) doc=obj.document;
// else I'm scewed - LOL
...
str = "whatever";
...
doc.open();
doc.write(str);
doc.close();
}

Works in IE6 and Netscape 7.1; don't know about the others.

Thanks for your help and patience.

gsb
Jul 20 '05 #7
In article <fz**********@hotpop.com>, Lasse Reichstein Nielsen <lr*@hotpop.com>
writes:
I like the simplicity of your solution, but it did not work in Netscape (I
have 7.1)


It works for me in Netscape 7.1 (freshly installed - damn them for
installing AOL without my permission!).


AOL or AIM? NS7 comes with the AOL IM service but I have never known it to
install the full blown AOL application.
--
Randy
Jul 20 '05 #8
JRS: In article <UV****************@news.uswest.net>, seen in
news:comp.lang.javascript, gsb <gs*@QWest.net> posted at Tue, 6 Jan 2004
20:31:25 :-
Thank you for responding.
My internet express auto add that stuff in the reply.


You chose to use it; it is for you to deal with its defects.

Before posting, it is advisable to read the FAQ with care.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #9
hi************@aol.com (HikksNotAtHome) writes:
AOL or AIM? NS7 comes with the AOL IM service but I have never known it to
install the full blown AOL application.


Actually, just an advertisment for AOL. I was thinking of AIM, but it
seems it worked to deselect it before installation. So, no that damn
was not deserved. Now they just get one for putting advertising on my
desktop :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #10
Lasse Reichstein Nielsen wrote:
It works for me in Netscape 7.1 (freshly installed - damn them for
installing AOL without my permission!).


You are looking for http://www.holgermetzger.de/compactfaq.html
HTH

PointedEars
Jul 20 '05 #11
Lasse Reichstein Nielsen wrote:
It works for me in Netscape 7.1 (freshly installed -
damn them for installing AOL without my permission!).


You are looking for http://holgermetzger.de/net7compd.html
(other language packs are available).
HTH

PointedEars
Jul 20 '05 #12
Thomas 'PointedEars' Lahn <Po*********@web.de> writes:
You are looking for http://holgermetzger.de/net7compd.html
(other language packs are available).


Does the page come in other languages too? :)
(Well, I can read German, it's just neither fast nor precise :)

I usually use Firebird anyway, so I'm not going to worry too much
about Netscape.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #13
Lasse Reichstein Nielsen wrote:
Thomas 'PointedEars' Lahn <Po*********@web.de> writes:
You are looking for http://holgermetzger.de/net7compd.html
(other language packs are available).


Does the page come in other languages too? :)


If you like

<http://translate.google.com/translate?u=http://holgermetzger.de/net7compd.html&langpair=de|en&hl=en&ie=Unknown&oe= ISO-8859-1>

it does ;-)
PointedEars
Jul 20 '05 #14

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

Similar topics

16
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
9
by: Arash Dejkam | last post by:
Hi All, Is it possible to write on an <OBJECT type="text/html"> using document.write() from within the html containing that tag the way we write on a popup window? I couldn't do that after a lot...
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
6
by: Jon Davis | last post by:
I recently learned how to do an <OBJECT> alternative to <IFRAME> in current browsers using: <object id="extendedhtml" type="text/html" data="otherpage.html" width="250" height="400"></object> ...
4
by: Kiyomi | last post by:
Hello, I am trying to replace my alert message box with a popup page. In my page behind,
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.