<html>
	<head>
		<title>Web just for training</title>
		<script type="text/javascrip">
				function chBG(kolor)
				{
				     document.getElementById('ab').style.background = kolor;
				}
		</script>
	</head>
	<body id="ab">
			<input type="button" name="b3" value="green" onclick="chBG(this.value)"><br/><br/>
			<input type="button" name="b4" value="blue" onclick="chBG(this.value)">
	</body>
</html>

Here is my code to change the background color but I does not work!I don't know why, please help me clarify the problem! Thank you!

>> Line 4 - <script type="text/javascrip"> needs to be <script type="text/javascript"> ~G

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.