我有一个 MVC 项目,它在 _Layout.cshtml 中有一个横幅
<img src="../../SitePics/NewBanner.jpg") class="BannerSize" />
和一个 Img 标记,用于根据当前的 logges 用户获取 Profile Pic
<img src="../../@Model.TripPic" class="TripImage" align="left" />
我已经和杰森一起实施了评级
<script language="javascript" type="text/javascript" src="../../Scripts/jquery-1.4a2.js"></script>
<script language="javascript" type="text/javascript">
$(function () {
$("img").mouseover(function () {
giveRating($(this), "FilledStar.png");
$(this).css("cursor", "pointer");
});
$("img").mouseout(function () {
giveRating($(this), "EmptyStar.png");
});
$("img").click(function () {
$("img").unbind("mouseout mouseover click");
// call ajax methods to update database
var url = "/Rating/PostRating?rating=" + parseInt($(this).attr("id"));
$.post(url, null, function (data) {
$("#result").text(data);
});
});
});
function giveRating(img, image) {
img.attr("src", "/Content/Images/" + image)
.prevAll("img").attr("src", "/Content/Images/" + image);
}
</script>
<p>
<img src="../../Content/Images/EmptyStar.png" alt="Star Rating" align="middle" id="1" />
<img src="../../Content/Images/EmptyStar.png" alt="Star Rating" align="middle" id="2" />
<img src="../../Content/Images/EmptyStar.png" alt="Star Rating" align="middle" id="3" />
<img src="../../Content/Images/EmptyStar.png" alt="Star Rating" align="middle" id="4" />
<img src="../../Content/Images/EmptyStar.png" alt="Star Rating" align="middle" id="5" />
</p>
<div id="result"></div>
我的问题是,当我运行程序时,我的横幅和个人资料图片在超出/超出鼠标指针时也会变为空或填充开始..
请帮助我阻止横幅和个人资料图片在 MouseOver 上发生变化