473,761 Members | 10,498 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getEle mentById("ifram e");
el.contentWindo w.location.relo ad();
}
var timer = null;
window.onload = function() {
timer = setInterval(rel oad, 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 2818
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.getEle mentById("ifram e");
el.contentWindo w.location.relo ad();
}
var timer = null;
window.onload = function() {
timer = setInterval(rel oad, 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*****@agrico reunited.com>
comp.lang.javas cript 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.getEle mentById("ifram e");
el.contentWindo w.location.relo ad();
}
var timer = null;
window.onload = function() {
timer = setInterval(rel oad, 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.getEle mentById("ifram e");
el.contentWindo w.location.relo ad();


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.javas cript 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.getEle mentById("ifram e");
el.contentWindo w.location.relo ad();


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.getEle mentById("ifram e");
el.data = "/content";
}
var timer = null;
window.onload = function() {
timer = setInterval(let s_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.getEle mentById("ifram e");
el.contentDocum ent.location.re load();
}

<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
3115
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, which needs a Quicktime plugin, and one Java applet. He's also kindly supplied me with sample HTML code for each. The code looks like this (simplified):
1
9088
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
2801
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" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>&lt;object&gt; test</title>
4
25413
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 following error: Argument '1': cannot convert from 'GenericsPOC.ArticleCollection' to 'System.Collections.Generic.IList<object>' I tried casting specifically to IList<object> but then I get a runtime error: Unable to cast object of type...
1
1648
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 message....
4
12045
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
2243
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. http://www.realss.com/workshop/061107 The page looks differently between Fx and IE. On Fx it's the correct look.
3
3468
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 frameset are wrong. My users are still using IE 6 and I have a frameset in most of my pages - this is just a one line tickertape thing but it has to stay there. The guy who wrote the site made some errors here (specifying xml strict but...
0
9521
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9333
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9945
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9900
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6599
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5214
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.