473,230 Members | 1,373 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,230 software developers and data experts.

Inherit Background from previous page

Is it posssible to inherit the previous pages (parent pages)
background image? Is there a script out there I could look at? Thanks
Jul 20 '05 #1
4 5287
Grant Wagner <gw*****@agricoreunited.com> wrote in message news:<3F***************@agricoreunited.com>...
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/...agechange.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.back ground

mike.
Jul 20 '05 #2
Not sure I see the point of doing this.

Why not just set up the background-image property in a stylesheet like...

body { background-image:URL("bg1.gif"); }
body.specific { background-image:URL("bg2.gif"); }

Then refer to that from your web pages

<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" <in********************@hotmail.com> wrote in message
news:80**************************@posting.google.c om...
Grant Wagner <gw*****@agricoreunited.com> wrote in message

news:<3F***************@agricoreunited.com>...
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/...agechange.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.back ground

mike.

Jul 20 '05 #3
mike wrote:
Grant Wagner <gw*****@agricoreunited.com> wrote in message news:<3F***************@agricoreunited.com>...
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/...agechange.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.back ground

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:

In Internet Explorer use:

<style type="text/css">
body { background-image:URL("3dblocks.gif"); }
</style>
<body>
<script type="text/javascript">
var w = window.open('about:blank');
w.document.body.style.backgroundImage = document.body.currentStyle.backgroundImage;
</script>

And in Mozilla you would use:

w.document.body.style.backgroundImage = document.defaultView.getComputedStyle(document.bod y,
"").backgroundImage;

Note that on a web site, both pages would have to come from the same domain for this to work, you can't
specify the backgroundImage for a page loaded in a new window which isn't from your domain.

Of course, the standard way to handle this is define the background image in one place, then specify:

<link rel="stylesheet" type="text/css" href="/path/to/file.css" />

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #4
Thats exactly what I ment - thanks Ill have to give this a whirl

Erik
Jul 20 '05 #5

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

Similar topics

6
by: Kai Grossjohann | last post by:
Is there a way in CSS to say that I want to have a class apptoolbar which is just like the toolbar class, only with a different bg color? My q&d approach was to copy the toolbar class definition...
4
by: Gary Hasler | last post by:
I have a full page of thumbnails linked to home plan pages. I'm adding a mouseover/mouseout effect to the table cells, plus a onclick event to permanently set the cell background to indicate the...
5
by: Jeff | last post by:
Greetings I am beginning a web app. I am using C# aspx forms for my web pages. Is it possible to create/use one aspx file as a base from which to derive other aspx files? I can not get this to...
1
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say...
0
by: djus | last post by:
Hello At the begining I'm sorry for my English :( I want my aspx page TestPage.aspx to inherit from MyClass2. MyClass2 inherits from MyMainClass which is subtype of Page: public class...
2
by: cosmo_canuck | last post by:
Hi all! I'm a web designer who's valiantly struggling, with occasional moments of triumph, to build my first fully CSS site. Hope that you can answer a couple of quick newbie questions. Page:...
21
by: tradmusic.com | last post by:
Hi, We have the following in our stylesheet, which acts as a page header: #homepageheader { left: 0px; top: 0px; right: 0px; height: 183px; background-image:...
18
by: LayneMitch | last post by:
Hello. After getting great advice on positioning, I've edited my code and it's looking more stable. Now I need a little assistance with background image placement. Please click on this...
2
by: GTalbot | last post by:
Hello fellow comp.infosystems.www.authoring.stylesheets colleagues, Imagine this situation: #grand-parent-abs-pos { height: 400px; position: absolute; width: 600px; }
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.