This code is working in Firefox 4.0b9.
As far as I know:
Code:
<html>
<head>
<style type="text/css">
div#pano1 { width: 100px; height: 161px; background-color: turquoise; }
div#pano2 { width: 100px; height: 161px; background-color: gold; }
.el { cursor : pointer; }
.ok { cursor : default; }
</style>
<script type="text/javascript">
function changeClass() {
var mydiv;
for(var i=1; i<3; i++) {
mydiv = document.getElementById('pano'+i);
mydiv.className = "ok";
}
}
</script>
</head>
<body>
<div id="pano1" class="el" > Fareyi buraya getir! </div>
<div id="pano2" class="el" > Fareyi buraya da getirebilirsin. </div>
<input type="button" value="click me to change class attribute of the div elements" onclick="changeClass()">
<br>
Search Google
Change HTML class attribute using javascript
Javascript Change Style Class of Div tag
</body>
</html>
Last edited by Ayşe; 12-09-2011 at 09:39 AM.
The Time Through Ages
In the Name of Allah, Most Gracious, Most Merciful
1. By the Time,
2. Verily Man is in loss,
3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.
Bookmarks