This is to show what can be done with a bit of JavaScript. Press the buttons to change the text and background colours. | ||||||
Text | ||||||
Background | ||||||
Each button has nearly the same code: | ||||||
<input type="button" value="Red" name="Red" onClick='document.fgColor="Red"'> | ||||||
This takes the onClick method of the button object and
changes the document object fgColor (Foreground colour, i.e. text)
attribute to red.
To change the background colour the bgColor attribute is used. |
||||||
Author: Nigel Gibson
Email: ng264@tutor.open.ac.uk