Advertisements

Grant Wagner <> wrote in message news:<>...
> erik wrote:
>
> > Is it posssible to inherit the previous pages (parent pages)
> > background image? Is there a script out there I could look at? Thanks
>
> The browser has no way of knowing what the background image of the
> previous page was. If you want to use the same background image, you'll
> have to set a cookie with the background image name and read it on each
> page, or pass the image name around on the URL.

Not entirly true. I've got what the OP dscribes to work without
cookies or passing in the url.
I've only tested it in mozilla 1.4 and I wouldn't like to comment on
the 'goodness' of the method though

If you use the [depricated] background attribute of the body tag to
specify the image you can change/reference it with javascript. (I
can't get it to work with body background images defined with css
though.)

In the opened window call the following line of javascript with an
onload on the body tag

<body class="specific"> which will pick up the bg2.gif background.
<body> will pick up the bg1.gif background.

I can see no conceivable purpose for inheriting the background from the
previous page, just use CSS.

Peter.

"mike" <> wrote in message
news:...
> Grant Wagner <> wrote in message
news:<>...
> > erik wrote:
> >
> > > Is it posssible to inherit the previous pages (parent pages)
> > > background image? Is there a script out there I could look at? Thanks
> >
> > The browser has no way of knowing what the background image of the
> > previous page was. If you want to use the same background image, you'll
> > have to set a cookie with the background image name and read it on each
> > page, or pass the image name around on the URL.
>
> Not entirly true. I've got what the OP dscribes to work without
> cookies or passing in the url.
> I've only tested it in mozilla 1.4 and I wouldn't like to comment on
> the 'goodness' of the method though
>
> I found part of the answer here -
>
> http://www.codebelly.com/javascript/backimagechange.html
>
> If you use the [depricated] background attribute of the body tag to
> specify the image you can change/reference it with javascript. (I
> can't get it to work with body background images defined with css
> though.)
>
> In the opened window call the following line of javascript with an
> onload on the body tag
>
> document.body.background=opener.document.body.background
>
>
>
> mike.

mike wrote:
> Grant Wagner <> wrote in message news:<>...
> > erik wrote:
> >
> > > Is it posssible to inherit the previous pages (parent pages)
> > > background image? Is there a script out there I could look at? Thanks
> >
> > The browser has no way of knowing what the background image of the
> > previous page was. If you want to use the same background image, you'll
> > have to set a cookie with the background image name and read it on each
> > page, or pass the image name around on the URL.
>
> Not entirly true. I've got what the OP dscribes to work without
> cookies or passing in the url.
> I've only tested it in mozilla 1.4 and I wouldn't like to comment on
> the 'goodness' of the method though
>
> I found part of the answer here -
>
> http://www.codebelly.com/javascript/backimagechange.html
>
> If you use the [depricated] background attribute of the body tag to
> specify the image you can change/reference it with javascript. (I
> can't get it to work with body background images defined with css
> though.)
>
> In the opened window call the following line of javascript with an
> onload on the body tag
>
> document.body.background=opener.document.body.background
>
> mike.

What you have done is open a new window and accessed the opener's background attribute. This is "inheriting"
the background image from a previous page. If that is what what the OP meant by "parent" page then sure, he
could jury rig the setup like this:

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!