Wrox Programmer Forums
|
BOOK: Professional JavaScript for Web Developers 2nd edition ISBN: 9780470227800
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers, 2nd Edition by Nicholas C Zakas; ISBN: 9780470227800
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers 2nd edition ISBN: 9780470227800 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 7th, 2009, 12:14 AM
Registered User
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamically changing the <object> element's loaded content

Hi All,

I am looking for a way to change and load a HTTP resource in a <object> element.

Code:
<object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" type="text/html" data="http://www.google.com" style="width: 1000px; height: 600px;"></object>
I have code like the above in one of my test page. The above code works correctly as a result I can avoid using iframe. Now assume that on a button click I would like to change the URL mentioned in the 'data' attribute of the object element, which is not working. Refer the code mentioned below:

Code:
window.onload = function() {
    setTimeout(function() {
        var o = document.body.getElementsByTagName("object")[0]; //o.setAttribute("data", "http://www.yahoo.com");
        o.data = "http://www.yahoo.com";
        alert(o.data);
    },
    1000);
}
The alert correctly shows the new URL that I had used from the JS. But the content loaded in the object tag element does not change.

Any help related to this would be appreciated.
 
Old August 19th, 2009, 06:37 AM
Authorized User
 
Join Date: Aug 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Post

Please I need this code too...

I have website that currently loads several Iframes and this hurts the loading times.

What I want to be able to do is to use <object> tag to display an image to begin with and then later, if the user so wishes, to be able to convert this same <object> to display external HTML page if user clicks a link. This will really improve load times...

PLEASE POST REPLY, thanks in advance.
 
Old August 21st, 2009, 12:58 AM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by semiotically View Post
What I want to be able to do is to use <object> tag to display an image to begin with and then later, if the user so wishes, to be able to convert this same <object> to display external HTML page if user clicks a link. This will really improve load times...
I don't know why you are trying to display an image using <object> when <img> tag is specifically for that. As far as iframes are concerned <object> seems to be a meaningful solution for most of the issues iframes creates.

But sadly not much is getting for using <object> instead of iframes..
 
Old October 5th, 2009, 08:14 AM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Though I haven't got any reply for my question here. I decided against to use the <object> element in place of <iframe> element until the browsers support them a bit more efficiently.

I have also stumbled across one such page in which the problem that I have mentioned in my first post can be solved.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Change <div> content areed24 ASP.NET 3.5 Basics 3 April 20th, 2009 09:59 PM
disable <div> content (everything inside it!) crmpicco Javascript How-To 2 April 12th, 2005 09:35 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
Dynamically Changing the content of a table cell asdasd Javascript 4 February 18th, 2005 01:44 PM
How to insert <META> tagg in .HTML whn is loaded? Abdul Hameed HTML Code Clinic 3 August 12th, 2004 04:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.