...

View Full Version : changing the "data" of an <object>



Xiong Chiamiov
06-28-2006, 02:15 AM
Hello. I am sorry that I do not have the actual code with me, as I am working on it at school (which has blocked CF) and I lost my flash drive 2 days ago. I will do my best to replicate it.

Here is what I am trying to do:
I have an <object>:


<object data="jan.html" id="calendar"></object>

and I am trying to change jan.html to feb.html with js in an onClick. I know how to do it with pictures (pic.src=""), but I have not succeeded with this. Is this possible? I have tried calendar.data="" and calendar.src="".

Side note: the reason for this is because I'm trying to avoid using an iframe. But if that is the way I must do it, then I will.

_Aerospace_Eng_
06-28-2006, 02:27 AM
You are trying to avoid the iframe because you are using a strict doctype?

jkd
06-28-2006, 02:29 AM
You can always try something like:

document.getElementById("calendar").contentDocument.location.href="newpage.html";

(For Firefox/Safari at least), while IE would be .contentWindow instead.

Xiong Chiamiov
06-28-2006, 02:33 AM
You are trying to avoid the iframe because you are using a strict doctype?
I'm trying to avoid iframes because I hate frames.


You can always try something like:

document.getElementById("calendar").contentDocument.location.href="newpage.html";

(For Firefox/Safari at least), while IE would be .contentWindow instead.
Thanks. I'll try that tomorrow. I forgot about getElementById.

_Aerospace_Eng_
06-28-2006, 02:36 AM
I'm trying to avoid iframes because I hate frames.


Thanks. I'll try that tomorrow. I forgot about getElementById.
An object tag is just as bad and is considered active scripting in IE so if active scripting was disabled in IE, the object would not even show up for the user.

Xiong Chiamiov
06-28-2006, 02:37 AM
An object tag is just as bad and is considered active scripting in IE so if active scripting was disabled in IE, the object would not even show up for the user.
Eh. So would using an iframe actually be better, as far as standards and ie and stuff go?

_Aerospace_Eng_
06-28-2006, 09:32 AM
Yeah I think it would be better.

PremiumBlend
06-29-2006, 01:17 AM
You could just use the XMLHttpRequest object to load the HTML into a div tag.

Here is a link that makes it pretty simple:
http://www.w3schools.com/dom/dom_http.asp



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum