Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional JavaScript for Web Developers 2nd edition ISBN: 9780470227800
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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.
Reply With Quote
  #2 (permalink)  
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.
Reply With Quote
  #3 (permalink)  
Old August 21st, 2009, 12:58 AM
Registered User
 
Join Date: Jul 2005
Location: , , .
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..
Reply With Quote
  #4 (permalink)  
Old October 5th, 2009, 08:14 AM
Registered User
 
Join Date: Jul 2005
Location: , , .
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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 07:50 AM
Dynamically Changing the content of a table cell asdasd Javascript 4 February 18th, 2005 12:44 PM
How to insert <META> tagg in .HTML whn is loaded? Abdul Hameed HTML Code Clinic 3 August 12th, 2004 04:49 AM



All times are GMT -4. The time now is 01:12 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.