Tuesday, 6 October 2020

ChangeButton-Color

 

<html>

 <head>

 <script type="text/javascript">

 function white()

{

document.body.style.backgroundColor="white"

}

function red()

{

document.body.style.backgroundColor="red"

}

 function blue()

{

document.body.style.backgroundColor="blue"

}

 function yellow()

{

document.body.style.backgroundColor="yellow"

}

 function fuchsia()

{

document.body.style.backgroundColor="fuchsia"

}

</script>

</head>

 <body>

<form>

 <p><input type="button" value="white background" name="B1" onclick="white()"></p>

<p><input type="button" value="red background" name="B2" onclick="red()"></p>

<p><input type="button" value="blue background" name="B3" onclick="blue()"></p>

<p><input type="button" value="yellow background" name="B4" onclick="yellow()"></p>

<p><input type="button" value="fuchsia background" name="B4" onclick="fuchsia()"></p>

 </form>

</body>

 </html>