473,382 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How a child window can read a parents stylesheet ?

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!

Aug 20 '07 #1
8 3828
In article
<11*********************@o80g2000hse.googlegroups. com>,
"Randell D." <fi************@gmail.comwrote:
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
Aug 20 '07 #2
On Mon, 20 Aug 2007 14:03:07 -0700, "Randell D."
<fi************@gmail.comwrote:
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.
Aug 20 '07 #3
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?

robert
Aug 21 '07 #4
Rik
On Tue, 21 Aug 2007 12:23:45 +0200, Robert Latest <bo*******@yahoo.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.
--
Rik Wasmus
Aug 21 '07 #5
Rik wrote:
On Tue, 21 Aug 2007 12:23:45 +0200, Robert Latest <bo*******@yahoo.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
Aug 21 '07 #6
On Aug 20, 11:03 pm, "Randell D." <fiprojects....@gmail.comwrote:
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...

Aug 21 '07 #7
On Aug 21, 1:27 am, Andy Dingley <ding...@codesmiths.comwrote:
On Mon, 20 Aug 2007 14:03:07 -0700, "Randell D."

<fiprojects....@gmail.comwrote:
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.
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?
Aug 21 '07 #8
Randell D. said the following on 8/21/2007 6:01 PM:
On Aug 20, 11:03 pm, "Randell D." <fiprojects....@gmail.comwrote:
>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/
Aug 21 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Suzanne Vogel | last post by:
Hi, I've been trying to write a function to test whether one class is derived from another class. I am given only id's of the two classes. Therefore, direct use of template methods is not an...
0
by: WillWeGetOurFreedomBack | last post by:
I am not a Christian. However, I am dedicated to exercising the single most valuable God-given asset possessed by the human species: Reason!...
4
by: james | last post by:
I have a custom UserControl, which can have many sub class levels derived from it. I want to be able to discover all the components at Load time, but the only components I can see from the base...
1
by: Johann Blake | last post by:
I have a dataset that contains a parent table and a child table. A DataRelation exists between the two. I was under the impression from reading the VS docs that when I filled the parent table, the...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
2
by: chuckdfoster | last post by:
I have 2 windows (MainPage.aspx and PopUp.aspx) and both have a textbox. I need the user to hit a button on the MainPage and the PopUp will show. Then I need the user to enter information in a...
4
by: beaker | last post by:
Hello, Is there a way to alter the opacity of an MDI child window? I've tried setting the Opacity property, but it has no effect on the children (fine for the parent though). (I want to...
8
by: Rick | last post by:
VS 2005 I' m setting up a parent/child datagridviews in a form. I am doing a lot of this by hand coding in order to get the feel of things. I want a change in the parent table to trigger a...
0
muaddubby
by: muaddubby | last post by:
Hi I've got a situation with a dataset that contains two tables with a many-to-one relationship, and am trying to extract the data in xml format. When I execute the GetXml() method, and exception...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.