【发布时间】:2010-07-07 09:52:17
【问题描述】:
我需要在鼠标悬停时更改链接图像。我使用了以下代码但不起作用。也许问题出在图像源上,但我仍然找不到他的代码有什么问题。
<!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><title>Edit Document</title>
<script src="../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#lnkEdit").hover(
function () {
this.src = this.src.replace("../images/edit_off.gif", "../images/edit_on.png");
},
function () {
this.src = this.src.replace("../images/edit_on.png", "../images/edit_off.gif");
}
);
});
</script>
</head>
<body>
<form method="post" action="Hover4.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTkwNjIyODQxZGR6kotcsbIsWRfokZrzasCtfPi0dxz4MBWWh9VxSJ6R0Q==" />
</div>
<div>
<a id="HyperLink1" href="Hover4.aspx"><img src="../images/edit_off.gif" alt="HyperLink" /></a>
</div>
</form>
提前致谢。
【问题讨论】:
标签: jquery