自己闲来没事写了个九九乘法表 ,新手入门。

 1 @using WebApp_Mvc_Wg_Api.Controllers;
 2 @{
 3     ViewBag.Title = "九九乘法表";
 4     //Layout = "~/Views/Shared/_Layout.cshtml";
 5 }
 6 <style>
 7     .main {
 8         width: 1000px;
 9         height:190px;
10     }
11 
12         .main li {
13             float: left;
14             width: 100px;
15             list-style: none;
16         }
17 </style>
18 <h2>@ViewBag.Title</h2>
19 
20 <div class="main">
21     @{
22         List<string> cf_list = ViewData["chenfabiao"] as List<string>;
23     }
24     <ul>
25         @foreach (var item in cf_list)
26         {
27             <li>@item.ToString()</li>
28         }
29     </ul>
30 </div>
31 
32 <hr />
33 
34 <h2>九九加法表</h2>
35 
36 <div class="main">
37     @{
38         List<string> jf_list = ViewData["jiafabiao"] as List<string>;
39     }
40     <ul>
41         @foreach (var item in jf_list)
42         {
43             <li>@item.ToString()</li>
44         }
45     </ul>
46 </div>
View Code
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Web;
 5 using System.Web.Mvc;
 6 
 7 namespace WebApp_Mvc_Wg_Api.Controllers
 8 {
 9     public class DemoController : Controller
10     {
11         // GET: Demo
12         public ActionResult Index()
13         {
14             return View();
15         }
16         public ActionResult chenfabiao()
17         {
18             jiafabiao();
19 
20             List<string> list = new List<string>();
21             for (int x = 1; x <= 9; x++)
22             {
23                 for (int y = 1; y <= 9; y++)
24                 {
25                     string formula = y + " * " + x + " = " + (x * y);
26                     formula = y > x ? "" : formula;
27                     list.Add(formula);
28                 }
29             }
30             ViewData["chenfabiao"] = list.ToList();
31             return View(ViewData["chenfabiao"]);
32         }
33 
34         public ActionResult jiafabiao()
35         {
36             List<string> list = new List<string>();
37             for (int x = 1; x <= 9; x++)
38             {
39                 for (int y = 1; y <= 9; y++)
40                 {
41                     string formula = y + " + " + x + " = " + (x +y);
42                     formula = y > x ? "" : formula;
43                     list.Add(formula);
44                 }
45             }
46             ViewData["jiafabiao"] = list.ToList();
47             return View(ViewData["jiafabiao"]);
48         }
49        
50     }
51 }
Controllers Code

页面结构

 

posted @ 2017-10-24 17:17 CanIHelpYou? 阅读(707) 评论(2) 推荐(0) 编辑
摘要: /*滚动条整体部分 定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/ ::-webkit-scrollbar { width: 12px; } /* 滚动条的轨道 内阴影+圆角*/ ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 阅读全文
posted @ 2015-07-03 14:21 CanIHelpYou? 阅读(575) 评论(1) 推荐(0) 编辑
摘要: ◇ 阅读全文
posted @ 2015-04-21 14:14 CanIHelpYou? 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 监听代码块执行时间 //监听代码块执行时间 Stopwatch sw = new Stopwatch(); sw.Start(); sw.Stop(); Console.WriteLine("{0}_执行时间:{1} ms", "func_"+ DateTime.Now.ToString("yyyy 阅读全文
posted @ 2024-09-25 10:30 CanIHelpYou? 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 思源笔记局域网内访问【使用教程】_思源笔记局域网访问-CSDN博客 思源笔记局域网内访问【使用教程】_思源笔记局域网访问-CSDN博客 https://blog.csdn.net/qq_22841387/article/details/124738674 文章浏览阅读4.3k次,点赞3次,收藏8次。 阅读全文
posted @ 2024-09-25 10:29 CanIHelpYou? 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 混淆指定js文件 fomartJs.bat @echo off REM 定义一个包含文件名的数组 set jsFiles=("polyfills.b4665eab.js" "manifest.b09f6bad.js" "index.f8bec5fb.js") REM 遍历数组中的每个文件 for % 阅读全文
posted @ 2024-09-25 10:21 CanIHelpYou? 阅读(65) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2015-04-21 15:06 CanIHelpYou? 阅读(881) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示