这是我的形象:如何更改视图IMG SRC MVC
<img id="1star" src="~/Content/Images/emptystar.png" onmouseover="setStars(1)" onmouseout="setStarsBack()" onclick="location.href='@Url.Action("SetRating", "CreativeModels", new { id = GlobalVariables.CurrentBookId, rating = 1 })'" />
这个功能应该改变图像的源代码:
function setStars(amount) {
if (amount > 0) {
document.getElementById("1star").src = "~/Content/Images/filledstar.png";
}
}
它改变了,但浏览器说,这它无法加载图像。这是鼠标移动到图片后什么浏览器显示:
这是图像移动鼠标到之前的样子图片:
我应该如何改变src
财产?
谢谢,这解决了我的问题! –