How a child window can read a parents stylesheet ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Randell D.

    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!

  • dorayme

    #2
    Re: How a child window can read a parents stylesheet ?

    In article
    <1187643787.034 908.20750@o80g2 000hse.googlegr oups.com>,
    "Randell D." <fiprojects.com @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

    Comment

    • Andy Dingley

      #3
      Re: How a child window can read a parents stylesheet ?

      On Mon, 20 Aug 2007 14:03:07 -0700, "Randell D."
      <fiprojects.com @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.

      Comment

      • Robert Latest

        #4
        Re: How a child window can read a parents stylesheet ?

        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

        Comment

        • Rik

          #5
          Re: How a child window can read a parents stylesheet ?

          On Tue, 21 Aug 2007 12:23:45 +0200, Robert Latest <boblatest@yaho o.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

          Comment

          • Jonathan N. Little

            #6
            Re: How a child window can read a parents stylesheet ?

            Rik wrote:
            On Tue, 21 Aug 2007 12:23:45 +0200, Robert Latest <boblatest@yaho o.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

            Comment

            • Randell D.

              #7
              Re: How a child window can read a parents stylesheet ?

              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...

              Comment

              • Randell D.

                #8
                Re: How a child window can read a parents stylesheet ?

                On Aug 21, 1:27 am, Andy Dingley <ding...@codesm iths.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?


                Comment

                • Randy Webb

                  #9
                  Re: How a child window can read a parents stylesheet ?

                  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="theSameFi leAsTheParent.c ss">

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

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

                  Comment

                  Working...