473,545 Members | 1,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write on <OBJECT type="text/html"> ?

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 of try.

Thanks in advance.
Jul 23 '05 #1
9 5347
Arash Dejkam wrote:
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 of try.

Thanks in advance.


Remember, you can use single quotes as well.

document.write( "<OBJECT type='text/html'>")
| |
Single quotes----------------+---------+

Don't cross-post, please.
Jul 23 '05 #2

"Will Gittoes" <As********@NoS pam.org> wrote in message
news:10******** *******@radsrv1 .tranzpeer.net. ..
Arash Dejkam wrote:
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 of try.

Thanks in advance.


Remember, you can use single quotes as well.

document.write( "<OBJECT type='text/html'>")
| |
Single quotes----------------+---------+

Don't cross-post, please.


You didn't get the point.
I don't want to write on my html but on the object frame itself, something
like this:

<object id="foo" type="text/html" />
<script>
foo.document.wr ite("Hello World!");
</script>
Jul 23 '05 #3
> Arash Dejkam wrote:
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 of try.

Thanks in advance.


Yes it is possible to output any type of mark-up at run-time using document.write.

--
Robert Collyer
www.webforumz.com
Free Web Design and Development Help, Discussions, tips and Critique!
ASP, VB, .NET, SQL, CSS, HTML, Javascript, Flash, XML, SEO !
Jul 23 '05 #4
Will Gittoes wrote:
Arash Dejkam wrote:
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 of try.

Thanks in advance.


Remember, you can use single quotes as well.

document.write( "<OBJECT type='text/html'>")
| |
Single quotes----------------+---------+

Don't cross-post, please.


or

document.write( "<OBJECT type=\"text/html\">")
| |
forces the character following to be ignored

--
x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
Jul 23 '05 #5
"Arash Dejkam" <de****@softhom e.net> wrote in
news:2m******** ****@uni-berlin.de:

"Will Gittoes" <As********@NoS pam.org> wrote in message
news:10******** *******@radsrv1 .tranzpeer.net. ..
Arash Dejkam wrote:
> 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 of try.
>
> Thanks in advance.
>
>


Remember, you can use single quotes as well.

document.write( "<OBJECT type='text/html'>")
| |
Single quotes----------------+---------+

Don't cross-post, please.


You didn't get the point.
I don't want to write on my html but on the object frame itself,
something like this:

<object id="foo" type="text/html" />
<script>
foo.document.wr ite("Hello World!");
</script>


What exactly are you trying to achieve?

There must be a better way, than the way you are approching this.

--
Robert Collyer
www.webforumz.com
Free Web Design and Development Help, Discussions, tips and Critique!
ASP, VB, .NET, SQL, CSS, HTML, Javascript, Flash, XML, SEO !
Jul 23 '05 #6


Arash Dejkam wrote:

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 of try.


You can do in Netscape 7, Mozilla and Opera 7 using the contentDocument
at least but it doesn't work in IE(5/6):

<html lang="en">
<head>
<title>the document object of an embedded object</title>
<script type="text/javascript">
function initObject () {
var object, objDoc;
if (document.getEl ementById && (object =
document.getEle mentById('anObj ect'))) {
if (object.content Document) {
objDoc = object.contentD ocument;
}
else if (object.content Window) {
objDoc = object.contentW indow.document;
}
if (objDoc) {
initDoc(objDoc) ;
}
}
}

function initDoc (doc) {
doc.open();
doc.write([
'<html><head><t itle>document.w ritten content<\/title><\/head>',
'<body><p>Kibol ogy for all.<\/p><\/body><\/html>'
].join('\r\n'));
doc.close();
}

window.onload = function (evt) {
initObject();
};
</script>
</head>
<body>
<p>
Here is the object:
<object type="text/html" id="anObject"
width="200" height="200"
data="about:bla nk"></object>
</p>
</body>
</html>

Can anyone report back whether the above writes to the object document
with Safari or Konqueror?

contentDocument is specified in the W3C DOM Level 2 HTML, see
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-38538621
so newer browser like Safari or Konqueror should support it.

But if you want to embed text/html and access its document then simply
go for
<iframe name="iframeNam e" ...></iframe>
and then you should have no trouble in browsers since IE4, Opera 6,
Netscape 6 etc accessing
window.frames.i frameName.docum ent
with script.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #7
Thanks Martin!

bad news it doesn't work in IE!, by the way, I tested your code in Opera
7.01 Build 2651 and it DIDN'T work! but worked in mozilla. I can't use
IFRAME because my page should be XHTML1.0 Strict.

Arash

"Martin Honnen" <ma*******@yaho o.de> wrote in message
news:40******** @olaf.komtel.ne t...


Arash Dejkam wrote:

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 of try.


You can do in Netscape 7, Mozilla and Opera 7 using the contentDocument
at least but it doesn't work in IE(5/6):

<html lang="en">
<head>
<title>the document object of an embedded object</title>
<script type="text/javascript">
function initObject () {
var object, objDoc;
if (document.getEl ementById && (object =
document.getEle mentById('anObj ect'))) {
if (object.content Document) {
objDoc = object.contentD ocument;
}
else if (object.content Window) {
objDoc = object.contentW indow.document;
}
if (objDoc) {
initDoc(objDoc) ;
}
}
}

function initDoc (doc) {
doc.open();
doc.write([
'<html><head><t itle>document.w ritten content<\/title><\/head>',
'<body><p>Kibol ogy for all.<\/p><\/body><\/html>'
].join('\r\n'));
doc.close();
}

window.onload = function (evt) {
initObject();
};
</script>
</head>
<body>
<p>
Here is the object:
<object type="text/html" id="anObject"
width="200" height="200"
data="about:bla nk"></object>
</p>
</body>
</html>

Can anyone report back whether the above writes to the object document
with Safari or Konqueror?

contentDocument is specified in the W3C DOM Level 2 HTML, see
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-38538621
so newer browser like Safari or Konqueror should support it.

But if you want to embed text/html and access its document then simply
go for
<iframe name="iframeNam e" ...></iframe>
and then you should have no trouble in browsers since IE4, Opera 6,
Netscape 6 etc accessing
window.frames.i frameName.docum ent
with script.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #8


Arash Dejkam wrote:

bad news it doesn't work in IE!, by the way, I tested your code in Opera
7.01 Build 2651 and it DIDN'T work!
One reason more to go for the iframe. Sorry for not being more specific
about Opera, I had only tested with Opera 7.50 on Windows and as I don't
use <object> myself to render text/html I had no knowledge about details
of Opera support for contentDocument .

but worked in mozilla. I can't use
IFRAME because my page should be XHTML1.0 Strict.


It is your decision, if that document type is important to you then you
can't use iframe but currently with the browsers around if you are
interested in consistent and reliable use and scripting then iframe is
much better than object.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #9
DU
Martin Honnen wrote:


Arash Dejkam wrote:

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 of try.

You can do in Netscape 7, Mozilla and Opera 7 using the contentDocument
at least but it doesn't work in IE(5/6):

<html lang="en">
<head>
<title>the document object of an embedded object</title>
<script type="text/javascript">
function initObject () {
var object, objDoc;
if (document.getEl ementById && (object =
document.getEle mentById('anObj ect'))) {
if (object.content Document) {
objDoc = object.contentD ocument;
}
else if (object.content Window) {

contentWindow can not apply to HTML object element
http://msdn.microsoft.com/workshop/a...tentwindow.asp

objDoc = object.contentW indow.document;
}
if (objDoc) {
initDoc(objDoc) ;
}
}
}

function initDoc (doc) {
doc.open();
doc.write([
'<html><head><t itle>document.w ritten content<\/title><\/head>',
'<body><p>Kibol ogy for all.<\/p><\/body><\/html>'
].join('\r\n'));
doc.close();

or

var objParg = doc.createEleme nt("p");
objParg.appendC hild(doc.create TextNode("Kibol ogy for all."));
doc.body.append Child(objParg);
since blank document have a body node.
}

window.onload = function (evt) {
initObject();
Isn't that asking for trouble? Like asynchronous onload events for
window and document body?
};

DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Mozilla 1.7.3 :)
Jul 23 '05 #10

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

Similar topics

9
13381
by: David D. | last post by:
Does the file extension matter when including a JavaScript file in an HTML page? Normally, one would include a JavaScript file in an HTML page using <script src="foo.JS" type="text/javascript"> However, I have found that I can use an alternate file extension, such as <script src="foo.HTML" type="text/javascript"> It works fine with my...
6
5231
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> My question is how do I access the document DOM of this object in Javascript? For example, "alert(extendedhtml.innerHTML);" doesn't work and...
1
6163
by: tilt | last post by:
Hello, I use an object element to replace the iframe element in ie, like this: <object id="x_obj" data="http://.../" type="text/html"> <iframe name="x_if" id="x_if" src="http://.../">
2
2247
by: alxasa | last post by:
Hello, I am hoping someone can help me with this. I need a javascript function, which sits inside a <input type="text" name="firstname"> line of code. Now, if someone starts typing fine, but when it goes 1 character past 15 characters (15 characters only allowed), in this case I would like the contents of the input to be cleared out...
1
7053
by: mark | last post by:
Forgive me if this seems like a stupid question but I need help... I'm trying to do a simple online form that emails me the results from a few fields. Here is the code: <form action="http://cm1web1/WebSurveyComponents/script/ processform.asp" method="post">
7
1737
by: Amzul | last post by:
hello all. can someone tell if its possible to put <strong> inside the value? whats the right syntax? and another Q is it possible to applay new style to a form i mean i want to disable all the text filed in the form but i dont want to go one by one and wirte disable="disabled" can i make calss or css (i realy dont know alot about it) ...
3
7811
by: joe | last post by:
Is it OK to have multiple: <script type="text/javascript" src="funcs1.js"></script> <script type="text/javascript" src="funcs2.js"></script> <script type="text/javascript" src="funcs3.js"></script> ? And I need to use similarly multiple CSS:
2
5827
by: Warren Tang | last post by:
Hello, everyone Can I make a <input type="text"tag transparent? I mean I can see through it and see the background of its container. Regards Warren
0
7457
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...
0
7802
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...
1
7410
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...
0
5962
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5320
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...
0
4941
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3443
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...
0
3438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1869
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.