杂记c-----小写金额转化成大写数字;点击表格table时,当前被点击的tr行变色,其它行不变色;input隐藏显示

public string chang(string money)
        {
            //将小写金额转换成大写金额            
            double MyNumber = Convert.ToDouble(money);
            String[] MyScale = { "", "", "", "", "", "", "", "", "", "", "亿", "", "", "", "", "", "", "" };
            String[] MyBase = { "", "", "", "", "", "", "", "", "", "" };
            String M = "";
            bool isPoint = false;
            if (money.IndexOf(".") != -1)
            {
                money = money.Remove(money.IndexOf("."), 1);
                isPoint = true;
            }
            for (int i = money.Length; i > 0; i--)
            {
                int MyData = Convert.ToInt32(money[money.Length - i].ToString());
                M += MyBase[MyData];
                if (isPoint == true)
                {
                    M += MyScale[i - 1];
                }
                else
                {
                    M += MyScale[i + 1];
                }
            }
            return M;
        }

 query实例:点击表格table时,当前被点击的tr行变色,其它行不变色

<script language="javascript">
//假设Table的ID为angel
$("#angel tr").click(function(){
  $(this).addClass("on").siblings("tr").removeClass("on");
});
</script>

上面代码中的意思:

addClass:是添加样式;

siblings:是用来获取同辈元素,siblings("tr")的意思就是获取同辈的tr元素;

removeClass:是去除样式;

input隐藏显示
function select(Type) {
    if (Type == 1) {
        $("input[id='addBtn']").show();
    }
    if (Type == 2) {
        $("input[id='updateBtn']").show();
    }
};

 

posted @ 2015-08-19 10:24  指尖的人生  阅读(254)  评论(0编辑  收藏  举报