MVC 视图中统制 div显示隐藏
MVC 视图中控制 div显示隐藏
现在有两个层里各有一个table
怎样根据model.TypeId 的值显示和隐藏 层
model.typeid 是0 显示 a
model.typeid 是1 显示 b
Javascript代码怎么写
------解决思路----------------------
<div id="a ">
<table border="1px" bordercolor="#696969" cellspacing="0px" style="width:auto">
<tr>
<td align="center" valign="top" colspan="6">
<p>
@*<span style="font-size: 10px; font-weight: bold">@Model.DisTypeId</span>*@
<span style="font-size: 10px; font-weight: bold">充值 信息</span>
</p>
</td>
</tr>
<tr>
<td align="center" valign="top" width="150px">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">充值金额</span>
</strong>
</p>
</td>
<td align="center" valign="top" width="150px">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">充值积分</span>
</strong>
</p>
</td>
</tr>
<tr>
<td align="center" valign="top" colspan="1">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">@Model.LoseMoney</span>
</strong>
</p>
</td>
<td align="center" valign="top" colspan="1">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">@Model.LosePoints</span>
</strong>
</p>
</td>
</tr>
</table>
</div>
<div id="b " >
<table border="1px" bordercolor="#696969" cellspacing="0px" style="width:auto">
<tr>
<td align="center" valign="top" colspan="6">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">消费 信息</span>
</strong>
</p>
</td>
</tr>
<tr>
<td align="center" valign="top" colspan="2">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">产品名称</span>
</strong>
</p>
</td>
<td align="center" valign="top" colspan="2">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">产品数量</span>
</strong>
</p>
</td>
</tr>
<tr>
<td align="center" valign="top" colspan="2">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">@Model.ProductName</span>
</strong>
</p>
</td>
<td align="center" valign="top" colspan="2">
<p>
<strong>
<span style="font-size: 6px; font-weight: bold; ">@Model.Amount</span>
</strong>
</p>
</td>
</tr>
</table>
</div>
现在有两个层里各有一个table
怎样根据model.TypeId 的值显示和隐藏 层
model.typeid 是0 显示 a
model.typeid 是1 显示 b
Javascript代码怎么写
------解决思路----------------------
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var model_typeid=0;
window.onload=function()
{
model_typeid=@model.typeid;
$(document).ready(
function(){
switch(model_typeid)
{
case 0:
$('#a').css('display','inline');
$('#b').css('display','none');
break;
case 1:
$('#a').css('display','none');
$('#b').css('display','inline');
break;
}
}
);
}
</script>