1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Background Colour Change

Often you can achieve a quite interesting result just by combining a couple of scripts together along with a couple of extra statements.

You can change the colour of the background of this page by selecting a colour from the following form:

The code itself is fairly straightforward. The only part of the form that contains any JavaScript is the select tag which reads:

<select name="xfer" size="1"
onchange="location = ''+ uri.file + '?colour=' +
continued from previous line this.options[this.selectedIndex].value;">

Each option in the select has the six digit code corresponding to the colour that option selects.

The JavaScript we need for the form to work includes both my Current Page Reference script (that's where the value of uri.file comes from) and the Read Function from my "Passing Parameters Via Query Strings" instructions (which will extract the option value back out of the querystring once the page reloads).

With those two functions in place the JavaScript to actually call those functions that goes in the head of your page looks like this:

var uri = new Object();
function start() {
qsParm['colour'] = 'ffffff';
continued from previous line.backgroundColor = '#'+qsParm['colour'];

©2016 About.com. All rights reserved.