[英]How to call a “div id” from a href tag
我有这样的代码,我想在确认后显示detailMess
。 那么,如何在 a-href 中调用div-id
:
<a href="" onclick="return confirm('1 time count if you click OK, Are you sure?');">Show contact details</a>
<div id="detailMess" style="display: none;">
<%
string uID = "-1";
var u = Membership.GetUser();
if (u != null) { uID = u.ProviderUserKey.ToString(); }
string U1 = Convert.ToString(Model.Load.OwnerId) ?? "";
bool isOwner = uID.Equals(U1, StringComparison.OrdinalIgnoreCase);
%>
<% if ((!LDC.Common.isShowLetGoContactInfor) || (User.IsInRole("Staff")) || (isOwner))
{ %>
<%
if (Model.User != null && Model.User.Profiles == null) { Model.User.Profiles = new LDC.Domain.Profile(); }
Html.RenderPartial("ContactInfo", Model);
%>
<% }
else
{ %>
<% Html.RenderPartial("LetgoContactInfo"); %>
<%} %>
</div>
请有人帮助我!
试试看:
<a href="#" onclick="document.getElementById('detailMess').show()">click</a>
我认为它会起作用。
嗨,试试下面的代码,它会帮助你...
<html>
<head>
<script type='text/javascript'>
function check()
{
if(confirm("1 time count if you click OK, Are you sure?"))
document.getElementById("sam").style.display="";
else
document.getElementById("sam").style.display="none";
}
</script>
</head>
<body>
<a href="#" onclick='check()'>check</a>
<div class="Sam" id="sam">Hi You are here now</div>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.