Click to See Complete Forum and Search --> : Calling js source


armstid
11-08-2003, 10:47 AM
On a regular .htm page, I have called a js page:

<script language=JavaScript src="pop2.js"></script>

On the htm page I want a form button to be called that when it is clicked changes the background color.

So I have this in pop2.js:

document.write('<form><input type="button" name="button" style="" value="CLICK ME TO CHANGE THE BACKGROUND COLOR" onclick="change()"></form>');

change()
{
document.bgColor = '#F8BDC2';
}

The button is called, but I can't get the change() function to work when the button is clicked. Could someone plase help me?

Thanks :)

fredmv
11-08-2003, 01:13 PM
function change()
{
document.body.style.backgroundColor = '#F8BDC2';
}

armstid
11-08-2003, 02:55 PM
Thanks!

hehe, I'm n00b