HighDots Forums  

How a child window can read a parents stylesheet ?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss How a child window can read a parents stylesheet ? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Randell D.
 
Posts: n/a

Default How a child window can read a parents stylesheet ? - 08-20-2007 , 04:03 PM






Folks,
I have a script that pops a calendar up - its a generic script that I
use across some of my webapps - I would like the script to be
intelligent enough to set its fonts and other colours to be the same
as the parent window that requested the window.open in the first
place.

How do I do this? My webapp users are majority IE7 but a few of us
prefer Firefox2 so something that is near cross-browser compatable
would be great.

Thanks!


Reply With Quote
  #2  
Old   
dorayme
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-20-2007 , 04:19 PM






In article
<1187643787.034908.20750 (AT) o80g2000hse (DOT) googlegroups.com>,
"Randell D." <fiprojects.com (AT) gmail (DOT) com> wrote:

Quote:
Folks,
I have a script that pops a calendar up - its a generic script that I
use across some of my webapps - I would like the script to be
intelligent enough to set its fonts and other colours to be the same
as the parent window that requested the window.open in the first
place.

How do I do this? My webapp users are majority IE7 but a few of us
prefer Firefox2 so something that is near cross-browser compatable
would be great.

The script pops the window up. The content of the window is what?
Some html file? If so, just put a link to the wanted stylesheet
in it.

--
dorayme


Reply With Quote
  #3  
Old   
Andy Dingley
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-20-2007 , 06:27 PM



On Mon, 20 Aug 2007 14:03:07 -0700, "Randell D."
<fiprojects.com (AT) gmail (DOT) com> wrote:

Quote:
I would like the script to be
intelligent enough to set its fonts and other colours to be the same
as the parent window
Intelligence is bad here: it's harder to implement, and the user might
have switched it (client-side JS) off. Of course, you're using a
fallback of a <a href > link and not just JavaScript, aren't you?

Instead, do it server-side. Just embed the same link to the same
stylesheet in both pages.

If you want some level of customisation within the site, keep the
stylesheet the same but change an overall class within this. This is
more robust - at least it falls back to some default if it doesn't get
subclassed correctly. Easiest way to do it is still largely server-side,
by passing the "context" as a command line parameter.


Reply With Quote
  #4  
Old   
Robert Latest
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-21-2007 , 05:23 AM



Randell D. wrote:

Quote:
I have a script that pops a calendar up
Bah. I hate those. If I were you I'd let the user just enter the date and
make the parsing very tolerant.

Any fans of mile-long pop-ups for country names or credit card expiration
dates out there?

robert


Reply With Quote
  #5  
Old   
Rik
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-21-2007 , 06:28 AM



On Tue, 21 Aug 2007 12:23:45 +0200, Robert Latest <boblatest (AT) yahoo (DOT) com>
wrote:

Quote:
Randell D. wrote:

I have a script that pops a calendar up

Bah. I hate those. If I were you I'd let the user just enter the date and
make the parsing very tolerant.

Any fans of mile-long pop-ups for country names or credit card expiration
dates out there?
My favourite is a double option: enter the date manually or click a little
button next to it to click it/'browse to it' in an inline calender pop up,
which fills the manual inputs.
--
Rik Wasmus


Reply With Quote
  #6  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-21-2007 , 10:35 AM



Rik wrote:
Quote:
On Tue, 21 Aug 2007 12:23:45 +0200, Robert Latest <boblatest (AT) yahoo (DOT) com
wrote:

Randell D. wrote:

I have a script that pops a calendar up

Bah. I hate those. If I were you I'd let the user just enter the date and
make the parsing very tolerant.

Any fans of mile-long pop-ups for country names or credit card expiration
dates out there?

My favourite is a double option: enter the date manually or click a
little button next to it to click it/'browse to it' in an inline
calender pop up, which fills the manual inputs.
Mine is dodgy JavaScript for the droplist boxes like the USPS's postage
calculator page when selecting a destination country from the mile-long
list that trap the click and not the change so the whole page reloads
with the *wrong* country before you can select the *right* one. A real
joy on dialup!

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #7  
Old   
Randell D.
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-21-2007 , 04:59 PM




Quote:
The script pops the window up. The content of the window is what?
Some html file? If so, just put a link to the wanted stylesheet
in it.
Thanks, but the popup is dynamically created (the calendar is in a
variable that is then passed to the popup via

windowName.document.write=myCalendarHtml;

So your suggestion doesn't help here...



Reply With Quote
  #8  
Old   
Randell D.
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-21-2007 , 05:01 PM



On Aug 20, 11:03 pm, "Randell D." <fiprojects.... (AT) gmail (DOT) com> wrote:
Quote:
Folks,
I have a script that pops a calendar up - its a generic script that I
use across some of my webapps - I would like the script to be
intelligent enough to set its fonts and other colours to be the same
as the parent window that requested the window.open in the first
place.

How do I do this? My webapp users are majority IE7 but a few of us
prefer Firefox2 so something that is near cross-browser compatable
would be great.
I have included folk from the javascript community this time around as
the solutions suggested by the stylesheet group is not what I am
looking for.

Thus - can someone tell me how a child window can take the CSS of its
parent opening window?

Thanks...



Reply With Quote
  #9  
Old   
Randell D.
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-21-2007 , 05:05 PM



On Aug 21, 1:27 am, Andy Dingley <ding... (AT) codesmiths (DOT) com> wrote:
Quote:
On Mon, 20 Aug 2007 14:03:07 -0700, "Randell D."

fiprojects.... (AT) gmail (DOT) com> wrote:
I would like the script to be
intelligent enough to set its fonts and other colours to be the same
as the parent window

Intelligence is bad here: it's harder to implement, and the user might
have switched it (client-side JS) off.
Clients all have javascript enabled - it is a web application and
users know its a requirement.

Quote:
Instead, do it server-side. Just embed the same link to the same
stylesheet in both pages.

If you want some level of customisation within the site, keep the
stylesheet the same but change an overall class within this. This is
more robust - at least it falls back to some default if it doesn't get
subclassed correctly. Easiest way to do it is still largely server-side,
by passing the "context" as a command line parameter.
No - this won't work for me either as my child window is dynamically
created and depends entirely on the parent for information... thus...
how can I query the parent opening window, read its CSS and utilise it
within the child window?




Reply With Quote
  #10  
Old   
Randy Webb
 
Posts: n/a

Default Re: How a child window can read a parents stylesheet ? - 08-21-2007 , 05:25 PM



Randell D. said the following on 8/21/2007 6:01 PM:
Quote:
On Aug 20, 11:03 pm, "Randell D." <fiprojects.... (AT) gmail (DOT) com> wrote:
Folks,
I have a script that pops a calendar up - its a generic script that I
use across some of my webapps - I would like the script to be
intelligent enough to set its fonts and other colours to be the same
as the parent window that requested the window.open in the first
place.

How do I do this? My webapp users are majority IE7 but a few of us
prefer Firefox2 so something that is near cross-browser compatable
would be great.

I have included folk from the javascript community this time around as
the solutions suggested by the stylesheet group is not what I am
looking for.

Thus - can someone tell me how a child window can take the CSS of its
parent opening window?
Include the same CSS file, definitions, etc into the child window.

Otherwise, you are going to have to write a CSS/HTML parser to determine
the styles from the parent window and apply them to a child window. Why
make it harder than it has to be?

<link rel="stylesheet" href="theSameFileAsTheParent.css">

And then give your elements in the child window the same classes as your
parent window.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.