473,320 Members | 1,951 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.

js with <object> in xhtml strict

There are no <iframe> tag in xhtml strict, instead I should use
<object>.
If I change <iframe> to <object> then my javascript stops working.
I am curious to how to use <object> with javascript ?

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
function reload() {
var el = document.getElementById("iframe");
el.contentWindow.location.reload();
}
var timer = null;
window.onload = function() {
timer = setInterval(reload, 4000);
}
</script>
</head>
<body>
<p>
Before
<iframe id="iframe" type="text/html" src="/content" width="330" height="57">
Blah
</iframe>
After
</p>
</body></html>
--
Simon Strandgaard
Jul 23 '05 #1
7 2790
Simon Strandgaard wrote:
There are no <iframe> tag in xhtml strict, instead I should use
<object>.

If I change <iframe> to <object> then my javascript stops working.
I am curious to how to use <object> with javascript ?

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
function reload() {
var el = document.getElementById("iframe");
el.contentWindow.location.reload();
}
var timer = null;
window.onload = function() {
timer = setInterval(reload, 4000);
}
</script>
</head>
<body>
<p>
Before
<iframe id="iframe" type="text/html" src="/content" width="330" height="57">
Blah
</iframe>
After
</p>
</body></html>

--
Simon Strandgaard


An <object> tag has no -src- attribute: <url:
http://www.w3.org/TR/REC-html40/stru...ts.html#h-13.3 />. Even if it did,
the <object> tag is not a window, so it doesn't have a -contentWindow-. The
<object> tag does have a -data- attribute, you can probably make use of that
fact.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #2
Grant Wagner wrote:
Simon Strandgaard wrote:
There are no <iframe> tag in xhtml strict, instead I should use
<object>.

If I change <iframe> to <object> then my javascript stops working.
I am curious to how to use <object> with javascript ?
[snip xhtml]
An <object> tag has no -src- attribute: <url:
http://www.w3.org/TR/REC-html40/stru...ts.html#h-13.3 />. Even if it
did, the <object> tag is not a window, so it doesn't have a
-contentWindow-. The <object> tag does have a -data- attribute, you can
probably make use of that fact.

I am curious if its possible to reload an <object>, when its xhtml strict?
I have tried with the following code, where I use <object>.. but it doesn't
work.. what am I doing wrong?

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
function reload() {
var el = document.getElementById("iframe");
el.contentWindow.location.reload();
}
var timer = null;
window.onload = function() {
timer = setInterval(reload, 4000);
}
</script>
</head>
<body>
<p>
Before
<object id="iframe" type="text/html" data="/content" width="330"
height="57">
Blah
</object>
After
</p>
</body></html>

--
Simon Strandgaard
Jul 23 '05 #3
Simon Strandgaard wrote:
Grant Wagner wrote:

Simon Strandgaard wrote:

There are no <iframe> tag in xhtml strict, instead I should use
<object>.

If I change <iframe> to <object> then my javascript stops working.
I am curious to how to use <object> with javascript ?

[snip xhtml]

An <object> tag has no -src- attribute: <url:
http://www.w3.org/TR/REC-html40/stru...ts.html#h-13.3 />. Even if it
did, the <object> tag is not a window, so it doesn't have a
-contentWindow-. The <object> tag does have a -data- attribute, you can
probably make use of that fact.


I am curious if its possible to reload an <object>, when its xhtml strict?


Did you not read what Grant had to say? An object has a data attribute,
make use of it. Not that hard to test trying to change its data
attribute (just setting it back to itself, or, setting it elsewhere and
then back).
I have tried with the following code, where I use <object>.. but it doesn't
work.. what am I doing wrong?

Several things.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
function reload() {
var el = document.getElementById("iframe");
el.contentWindow.location.reload();


objects have no contentWindow, read what Grant said.

Not a good idea to name your function "reload()" either. It conflicts
with the native reload() method.

el.data = "/content";
might be a place to start.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #4
Randy Webb wrote:
Simon Strandgaard wrote:
Grant Wagner wrote:

Simon Strandgaard wrote:
There are no <iframe> tag in xhtml strict, instead I should use
<object>.

If I change <iframe> to <object> then my javascript stops working.
I am curious to how to use <object> with javascript ?
[snip xhtml]

An <object> tag has no -src- attribute: <url:
http://www.w3.org/TR/REC-html40/stru...ts.html#h-13.3 />. Even if it
did, the <object> tag is not a window, so it doesn't have a
-contentWindow-. The <object> tag does have a -data- attribute, you can
probably make use of that fact.


I am curious if its possible to reload an <object>, when its xhtml
strict?


Did you not read what Grant had to say? An object has a data attribute,
make use of it. Not that hard to test trying to change its data
attribute (just setting it back to itself, or, setting it elsewhere and
then back).


Yes, I read it, but I cannot get (el.data = "someurl") working.
Im very interested in getting it working.

I have tried with the following code, where I use <object>.. but it
doesn't work.. what am I doing wrong?


Several things.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
function reload() {
var el = document.getElementById("iframe");
el.contentWindow.location.reload();


objects have no contentWindow, read what Grant said.


Yes, I saw that. I have unsuccessfully tries with data.

Not a good idea to name your function "reload()" either. It conflicts
with the native reload() method.

el.data = "/content";
might be a place to start.

When I assign el.data to the URL, then nothing happens (Firefox +
Konqueror). Here is my code. I want to reload the <object>, but
don't know how?
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
function lets_refresh() {
var el = document.getElementById("iframe");
el.data = "/content";
}
var timer = null;
window.onload = function() {
timer = setInterval(lets_refresh, 4000);
}
</script>
</head>
<body>
<p>
Before
<object id="iframe" type="text/html" data="/content" width="330"
height="57">
Blah
</object>
After
</p>
</body></html>
Any help is appreciated.

--
Simon Strandgaard
Jul 23 '05 #5


Simon Strandgaard wrote:

When I assign el.data to the URL, then nothing happens (Firefox +
Konqueror). Here is my code. I want to reload the <object>, but
don't know how?


Use the latest version of Opera then, that can do it. Seriously, if you
want to embed a HTML document in one document and then be able to script
it better forget about <object> and use <iframe> instead, iframe is
rather consistently implemented in older and newer browsers while
<object> is a mess, in particular when it comes to scripting the loaded
document. I know that you want XHTML 1.0 strict which has no iframe but
if you want a solution that works across browsers <object> doesn't help
and you are better off with <iframe> and XHTML 1.0 transitional.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #6
Martin Honnen wrote:
Simon Strandgaard wrote:
When I assign el.data to the URL, then nothing happens (Firefox +
Konqueror). Here is my code. I want to reload the <object>, but
don't know how?


Use the latest version of Opera then, that can do it. Seriously, if you
want to embed a HTML document in one document and then be able to script
it better forget about <object> and use <iframe> instead, iframe is
rather consistently implemented in older and newer browsers while
<object> is a mess, in particular when it comes to scripting the loaded
document. I know that you want XHTML 1.0 strict which has no iframe but
if you want a solution that works across browsers <object> doesn't help
and you are better off with <iframe> and XHTML 1.0 transitional.


Ok, I suspected that this feature still wasn't fully supported yet.
Thanks for confirming this. If more people can confirm this then please do.

btw: <iframe> is much easier to search for than <object>.
if anyone has interest in what I need <object> or <iframe> for,
then have a look here:
http://ros.rubyforge.org/output/frontend/

comments still welcome :-)

--
Simon Strandgaard
Jul 23 '05 #7
I have found a way, that works in Firefox.
(but doesn't work in Konqueror).
function lets_refresh() {
var el = document.getElementById("iframe");
el.contentDocument.location.reload();
}

<object id="iframe" type="text/html" data="/page.cgi" width="330"
height="57">
Blah
</object>
Im still interested in a solution that works in Konqueror.
If anyone happens to know this.. then please let me know.

--
Simon Strandgaard
Jul 23 '05 #8

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

Similar topics

0
by: Wolfgang Schwanke | last post by:
Dear usenet, I'm having the following small problem. I've been ask to add some Quicktime panoramas to a website. The author of the panoramas has made two versions of each: One in MOV format,...
1
by: chotiwallah | last post by:
this is the html: <a href="Javascript:change();">change</a> <object data="a.htm" type="text/html" width="200" height="200" id="obj"></object> and this the javascript:
6
by: Christopher Benson-Manica | last post by:
(I posted this as a reply to my thread about iframes, but I think it may get mostly ignored there.) http://ataru.gomen.org/files/test.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"...
4
by: KC | last post by:
Could some one explain to me the casting rules for sending generic lists, ex. List<Person>, to a function that accepts List<object>? I cannot get the following easy-cheesy app to work. I get the...
1
by: easy.lin | last post by:
.... <object id="10">door</object> .... I try to write this in clipse XSD editor <element name="object" type="string"> <attribute name="id" type="int"></attribute> </element> but get wrong...
4
by: colson | last post by:
Hi, If I have a class A, and a List<List<object>> containing instances of A. How do I explicitly cast List<List<object>> as List<List<A>>?
5
by: 张韡武 | last post by:
Hello. On one webpage I just worked out, I use svg (by using <object>) for browser that supports svg (firefox), and give an <imginside of <objectas a fallback for IE. ...
3
by: mark4asp | last post by:
According to this <http://css-discuss.incutio.com/?page=BoxModelHack> IE6 will display differently to the W3C standard. Only IE6/strict and I suppose IE 7 display correctly. IE 6 transitional and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.