我有两个图像和两个单选按钮。
如果单击图像,将选择readio按钮。
但现在我想将图像作为链接。这样你就可以通过普通链接看到了。
这是html:
@if (Html.GebruikerContext().Klant.LogoIDSpecified)
{
<div class="property wide extra-margin">
<br />
<label>
Kies header logo
</label>
<div class="email-logo">
<label>
<span class="email-logo-image">
<img src='/Beheer/Images/mainlogo_274x122.png' />
</span>
<span class="email-logo-button">
@Html.RadioButton("logo-selectie", "standaard", !Model.GebruikKlantLogo, new { @name = "logoKeuze" })
<span>standaard logo</span>
</span>
</label>
</div> <div class="email-logo">
<label>
<span class="email-logo-image">
<img src='/Beheer/Document/Download?documentID=@(Html.GebruikerContext().Klant.LogoID)' />
</span>
<span class="email-logo-button">
@Html.RadioButton("logo-selectie", "klant", Model.GebruikKlantLogo, new { @name = "logoKeuze" })
<span>eigen logo</span>
</span>
</label>
</div>
</div>
}
这是javascript:
$('#logo-selectie[value=standaard]').change(function () {
$('#GebruikKlantLogo').val(false);
});
$('#logo-selectie[value=klant]').change(function () {
$('#GebruikKlantLogo').val(true);
});
答案 0 :(得分:4)
如果您希望图片像链接一样,请将图片放在<a>
标记中。
如果你只是想看“手”那么你必须写一个CSS
.classname {
cursor: pointer;
}
<img class="classname" src='/Beheer/Images/mainlogo_274x122.png' />
答案 1 :(得分:0)
除非我误解,否则我认为你已经过度思考了这个问题。要在鼠标悬停在图像上时显示指针,您只需添加少量CSS来设置图像样式。
$(".mainFolder").click(function (e) {
$(this).find("a")[0].click();
});
$(".secondFolder").click(function (e) {
$(this).find("a")[0].click();
});
&#13;
.showPointer {
cursor: pointer;
}
&#13;