zoukankan      html  css  js  c++  java
  • 在网页中显示数学符号

    在网页中显示一些符号,如数学符号(Insus.NET仅提供常用符号):

    前提条件是你的网页是支持utf-8,如在web.config设置如下:

    View Code
    <configuration> 
      <system.web>   
        <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" />   
      </system.web> 
    </configuration>

    .aspx:

    View Code
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowSymbol.aspx.cs" Inherits="ShowSymbol" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:DataList ID="DataListSymbol" runat="server" RepeatColumns="9" RepeatDirection="Horizontal" Width="100%">
               <ItemStyle BorderStyle="Solid" BorderWidth="1px" />
                 <ItemTemplate>
                    <%Eval("key"%>:&nbsp;<asp:Label ID="Label1" runat="server" Text='<%# Eval("value") %>'  ForeColor="Blue"></asp:Label>
                </ItemTemplate>
            </asp:DataList>
        </div>
        </form>
    </body>
    </html>

    .aspx.cs:

    View Code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public partial class ShowSymbol : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Data_Binding();
            }
        }

        private void Data_Binding()
        {
            this.DataListSymbol.DataSource = Symbol();
            this.DataListSymbol.DataBind();
        }

        private Dictionary<stringstring> Symbol()
        {
            Dictionary<stringstring> sym = new Dictionary<stringstring>();
            sym.Add("总和""");
            sym.Add("全等于号""");
            sym.Add("正负号""±");
            sym.Add("加号;正号""");
            sym.Add("减号;负号""");
            sym.Add("乘号""×");
            sym.Add("除号""÷");
            sym.Add("无限大号""");
            sym.Add("因为""");
            sym.Add("所以""");
            sym.Add("垂直于""");
            sym.Add("""");
            sym.Add("""");
            sym.Add("平方根""");
            sym.Add("""°");
            sym.Add("""");
            sym.Add("""");
            sym.Add("百分之…""");
            sym.Add("摄氏度""");
            sym.Add("约等于号""");
            sym.Add("直径符号""Ø");
            sym.Add("四分之一符号""¼");
            sym.Add("二分之一符号""½");
            sym.Add("四分之三符号""¾");
            sym.Add("一次方符号""¹");
            sym.Add("平方符号""²");
            sym.Add("立方符号""³");       
            return sym;
        }
    }


     

  • 相关阅读:
    禁止 git 自动转换换行符
    一个单元测试问题的解决
    关于脏读、幻象读、不可重复读的理解
    PKCS7 的 attached 和 detached 方式的数字签名
    关于DES加密中的 DESede/CBC/PKCS5Padding
    解决grep的结果无法显示文件名的问题
    解决64位操作系统下运行psql的问题
    一个用于将sql脚本转换成实体类的js代码
    批量将代码中的 get_XXX 替换成 XXX
    关于数据库中密码的存储
  • 原文地址:https://www.cnblogs.com/insus/p/2717563.html
Copyright © 2011-2022 走看看