Jquery simple rollover

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<!-- Load jQuery -->
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery","1.3.2");
</script>

</head>
<body>

<!-- jQuery Rollover -->
<script type="text/javascript">
jQuery(document).ready(function() {

$("img.rollover").hover(
function()
{
this.src = this.src.replace("_off","_on");
},
function()
{
this.src = this.src.replace("_on","_off");
}
);

});
</script>

<a href="http://hyperspatial.com"><img class="rollover" src="graphics/go_btn_off.png" width="60" height="21" alt="Button1" /></a>

<a href="http://hyperspatial.com"><img class="rollover" src="graphics/go_btn_off.png" width="60" height="21" alt="Button2" /></a>

</body>
</html>

3 Comments

You must be logged in to post a comment.


  1. wow, that was easy! thanks for posting this.


  2. Tanks a lot, very simple as usual with JQuery !


  3. Excellent works perfectly.