Tue Jan 01, 2013 12:01 am
<html>
<head>
<title>Change CSS Properties</title>
<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script>
$(document).ready(function(){
$("button#b1").click(function(){
$("p#p1").css({"background-color":"red","width":"500px","height":"160px"});
});
$("button#b2").click(function(){
$("p#p2").css({"background-color":"yellow","font-size":"xx-large"
,"color":"blue","height":"200px","border":"1px solid"});
});
});
</script>
<style type="text/css">
.class1
{
font-size:xx-large;
font-weight:bold;
background:#BC6201;
height:400px;
width:400px;
text-align:center;
text-decoration: underline;
color:blue;
}
.class2
{
color:red;
background:#52F201;
height:400px;
width:400px;
}
</style>
</head>
<body>
<p id="p1" class="class1">This paragraph is affected by CSS class1</p>
<p id="p2" class="class2">This paragraph is affected by CSS claas2</p>
<br>
<button id="b1">Change CSS of first paragraph</button>
<button id="b2">Change CSS of second paragraph</button>
</body>
</html>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.