<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>sample4</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("img.rollover").each(function(){
$("<img>").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
});
if($.browser.msie && $.browser.version<7){
$("img.rollover").each(function(){
$(this)
.data("src",$(this).attr("src"))
.attr("src","images/transparent.gif")
.css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src")+"',sizingMethod='scale')");
}).mouseover(function(){
$(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2")+"',sizingMethod='scale')");
}).mouseout(function(){
$(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src")+"',sizingMethod='scale')");
});
}else{
$("img.rollover").mouseover(function(){
$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
}).mouseout(function(){
$(this).attr("src",$(this).attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2"));
});
}
});
</script>
<style type="text/css">
div{
width:600px;
height:400px;
background:url("images/background.jpg");
margin:100px auto;
}
ul{
padding: 10px;
margin:0;
}
ul li{
width:140px;
height:40px;
list-style-type:none;
float:left;
}
ul li img{
width:140px;
height:40px;
border:none;
}
</style>
</head>
<body>
<div>
<ul>
<li><a href="#"><img src="images/jquery.png" alt="jQuery" class="rollover" /></a></li>
<li><a href="#"><img src="images/javascript.png" alt="javascript" class="rollover" /></a></li>
<li><a href="#"><img src="images/css.png" alt="CSS" class="rollover" /></a></li>
<li><a href="#"><img src="images/html.png" alt="HTML" class="rollover" /></a></li>
</ul>
</div>
</body>
</html>
最終更新:2012年05月23日 23:48