MVC里的分部视图的div如何显示和隐藏

2024-12-16 09:16:45
推荐回答(2个)
回答1:


    
        
            
                
                    


                        @*@Model.DisTypeId*@
                        充值 信息
                    


                
            
            
                
                    


                        
                            充值金额
                        

                    


                
                
                    


                        
                            充值积分
                        

                    


                
            
            
                
                    


                        
                            @Model.LoseMoney
                        

                    


                
                
                    


                        
                            @Model.LosePoints
                        

                    


                
            
        
    


    
        
            
                
                    


                        
                            消费 信息
                        

                    


                
            
            
                
                    


                        
                            产品名称
                        

                    


                
                
                    


                        
                            产品数量
                        

                    


                
            
            
                
                    


                        
                            @Model.ProductName
                        

                    


                
                
                    


                        
                            @Model.Amount
                        

                    


                
            
        
    

现在有两个层里各有一个table
怎样根据model.TypeId 的值显示和隐藏 层

model.typeid  是0   显示  a
model.typeid  是1   显示  b


    
      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;
                } 
              }
          
          );
      }
    

回答2:


    function showhide() {
        var s = document.getElementById("#showorhide");
        if (s.style.display == 'block') {
            s.style.display = 'none';
        } else {
            s.style.display = 'block';
        }
    }


    此处,调用分布视图

相关问答
最新问答