我想点击整个DIV
并重定向到下一页。如何编辑此代码。我是MVC
这是我的MVC
5代码:
.defaultpage_menu {
cursor:pointer;
text-decoration:none;
color:white;
}
.defaultpage_menu:hover{
text-decoration:none;
color:black;
}
.defaultpage_menu_button{
width:50%;
height:50%;
}
.default_menu_title {
margin:25% 30% 25% 35%;
font-weight:bold;
}
<a>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 defaultpage_menu_button" id="defaultpage_menu_userlisting">
<h1 class="default_menu_title">@Html.ActionLink("User Listing", "Index", "UserTables", new { area = "" }, new { @class = " defaultpage_menu" })</h1>
</div>
</a>
答案 0 :(得分:2)
<a href="@Url.Action("Index","UserTables")" class="defaultpage_menu">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 defaultpage_menu_button" id="defaultpage_menu_userlisting">
<h1 class="default_menu_title">User Listing</h1>
</div>
</a>
答案 1 :(得分:0)
你可以用jQuery(或者,Javascript)
来做到这一点$("div").click(function(){
window.location.replace("http://your.next.page/");
});
答案 2 :(得分:0)
尝试一次
var status = document.getElementById("status").innerHTML;
if(status == 778){
$('#status').attr('src','https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Button_Icon_Green.svg/200px-Button_Icon_Green.svg.png');
}else{
$('#status').attr('src','https://upload.wikimedia.org/wikipedia/commons/thumb/0/07/Button_Icon_Red.svg/200px-Button_Icon_Red.svg.png');
}
&#13;
$(document).ready(function(){
$('.link').click(function(){
window.location = "http://www.google.com/";
});
});
&#13;
.link{
width:100px;
height:100px;
border:1px solid #ff9900;
cursor:pointer;
}
&#13;