Changing the stylesheet of a nested page at runtime

First off, I apologize if this doesn't make sense. I'm new to XHTML, CSS and JavaScript.

I gather that in XHTML, the correct way to have a nested page is as follows (instead of an iframe):

<object name="nestedPage" data="" type="text/html" 
width="500" height="400" />

If I have a nested page like that - is it possible to change the stylesheet used by the nested page at runtime using JavaScript in the parent page? Ideally this would happen immediately so that the nested page would never be visible with its original stylesheet.

Please assume that you do not have control of the original source code of the nested page, yet it is on the same domain (don't ask)


d = document.getElementsByTagName('object').namedItem('nestedPage').getContentDocument();
d.styleSheets[d.styleSheets.length].href = 'whereever';

WARNING: hasn't been tested in all browsers.

Need Your Help

Finding out if two rectangles intersect


This is a homework assignment, so I'm mostly asking for a nudge in the right direction. I've figured out the majority of the problem. We have a Rectangle class, whose rectangles are defined by the ...

Table Cell background and text color cannot be set accurately.

iphone objective-c ios

I need to set the background of table cells to a specific color.

Crystal's rpt published to the wrong folder visual-studio-2010 crystal-reports

I am using ASP.NET MVC 2 in Visual Studio 2010. In my project I have created a 'Crystal' folder containing crystal reports .rpt files. I have set the 'build action' of each .rpt files to 'Content',

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.