Sunday, December 25, 2011

change the background and foreground effect


Example : change the background and foreground effect of the paragraph when you click on the button.

<html>
<head>
<title> css function</title>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").css("color", "#fff");
$("p").css("background", "maroon");
$("p").css("font", "20px tahoma");
});
});
</script>
</head>

<body>
<center>
<h2>change the background and foreground effect of the paragraph when you click on the button.</h2>
<p>[I am a paragraph. when you click on the button, it will be change the effect of background and foreground.] </p>
<button>Click me</button>
</center>
</body>
</html>

No comments:

Post a Comment