June 8, 2009

0 change background color of your web page


change background of your webpage with this script, just add the name in the textbox and color in the color box in output and click change background, color will change it according to the color name given in the text box.


<html>

<head>
<title>Form Fields</title>
<script type="text/javascript">
function changeBg(){
var userName = document.forms[0].UserName.value;
var bgColor = document.BgForm.BgColor.value;

document.bgColor = bgColor;
alert(userName + ", the background color is " + bgColor + ".");
}
</script>
</head>
<body>
<h1>Change Background Color</h1>
<form name="BgForm">

Your Name: <input type="text" name="UserName" size="10"><br/>
Background Color: <input type="text" name="BgColor" size="10"><br/>

<input type="button" value="Change Background" onclick="changeBg();">
</form>
</body>
</html>

0 comments:

Post a Comment

Blogger Themes

 
Powered by Blogger