Click to See Complete Forum and Search --> : background change


Beaverman
12-17-2003, 03:43 AM
How can I change the background colour of a page, from a button on another page?

Kor
12-17-2003, 05:14 AM
See an example in attachment

If you need further explanation, let me know

Beaverman
12-17-2003, 05:28 AM
That looks fine. But what happens where users block pop-ups. I really need the script to load the page with the selected background color from clicking on the button.

Kor
12-17-2003, 05:44 AM
You said


How can I change the background colour of a page, from a button on another page?


I understood you want to change something from another page is it correct?

Now, you can not change something from a page to another unless there is a certain relation between them, as far as to be able to have a reference from one to another. There are several types of possible references (between frames, paren-frame, frame-frame, page-popup, page-opened page).

Tell me what in fact you want to do and I might show you how to do it.

PS

If you want avoid the popup see that that my example will do the same if you insert the following in the body of the index.html

<a href="pop.html" target="_blank">open the new page</a>

Notice that the function is fired ONLY if the second page is opened (href or javascript, it does not matter) from within the first page). There must be a relationship between those two pages, this is what you must understand.

Beaverman
12-17-2003, 05:52 AM
The relationship would be made on the selection of the background color. On selection, the newpage would load with the background selected. (hope that makes sense)
<center>
<form type=get action="newpage.html">
<table border=0>
<tr>
<td><input type=button name=Blue value=blue></td>
</tr>
<tr>
<td><input type=button name=Red value=red></td>
</tr>
<tr>
<td><input type=button name=Green value=green></td>
</tr>
<tr>
</td>
</tr>
</table>
</form>
</center>

Kor
12-17-2003, 07:13 AM
OK. The key method is using the reference window.opener to pass/get a value from the main page to the new page

Try the attached simple example to see if it suits to you

Beaverman
12-17-2003, 09:17 AM
Thank You Kor. that seems to work well. Thank you again for all your help.