Forum Moderators: open
<html>
<head>
<style type="text/css">
img
{
opacity:0.4;
filter:alpha(opacity=40);
}
</style>
</head>
<body>
<img src="http://www.w3schools.com/Css/klematis.jpg" width="150" height="113" alt="klematis"
onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />
<img src="http://www.w3schools.com/Css/klematis2.jpg" width="150" height="113" alt="klematis"
onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />
</body>
</html> <html>
<head>
<style type="text/css">
img
{
opacity:0.4;
filter:alpha(opacity=40);
}
</style>
<script type="text/javascript">
function getElements()
{
var x=document.getElementsByTagName("img");
x.style.opacity=1; x.filters.alpha.opacity=100;
}
</script>
</head>
<body>
<img src="http://www.w3schools.com/Css/klematis.jpg" width="150" height="113" alt="klematis"
onmouseover="getElements()"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />
<img src="http://www.w3schools.com/Css/klematis2.jpg" width="150" height="113" alt="klematis"
onmouseover="getElements()"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />
</body>
</html>
<html>
<head>
<style type="text/css">
img {
opacity: 0.4;
filter: alpha(opacity=40);
}
</style>
</head>
<body>
<img src="http://www.w3schools.com/Css/klematis.jpg" width="150" height="113" alt="klematis" />
<img src="http://www.w3schools.com/Css/klematis2.jpg" width="150" height="113" alt="klematis" />
<script src="main.js" type="text/javascript"></script>
</body>
</html>
(function () {
var i,
imgList = document.getElementsByTagName("img"),
n;
// Attach event listeners
for (i = 0, n = imgList.length; i < n; i++) {
imgList[i].onmouseover = (function (img) {
return function(){
img.style.opacity = 1;
img.filters.alpha.opacity = 100;
};
})(imgList[i]);
imgList[i].onmouseout = (function (img) {
return function(){
img.style.opacity = 0.4;
img.filters.alpha.opacity = 40;
};
})(imgList[i]);
}
})();