So far I have
[code=javascript]
function color()
{
var box = document.getEle mentById('messa ge');
box = box.style.color = "#FF0000";
}
[/code]
So with that when you press the link, the text in the the textbox turns red.
I don't want to have to repeat a lot of code over and over for different colours. Is there anyway I can use one function to change to different colours?
So if the onclick is color(red) it turns red or color(blue) turns blue etc...
Would that be possible and what code would I need?
Hope I was clear,
Thanks,
Sam
[code=javascript]
function color()
{
var box = document.getEle mentById('messa ge');
box = box.style.color = "#FF0000";
}
[/code]
So with that when you press the link, the text in the the textbox turns red.
I don't want to have to repeat a lot of code over and over for different colours. Is there anyway I can use one function to change to different colours?
So if the onclick is color(red) it turns red or color(blue) turns blue etc...
Would that be possible and what code would I need?
Hope I was clear,
Thanks,
Sam
Comment