//只能输入正数,可以有小数点,小数点后面两位。
function CheckNum(obj) {
//onkeyup="this.value = (this.value.match(/d+(.d{0,2})?/) || [''])[0]"
obj.value = (obj.value.match(/d+(.d{0,2})?/) || [''])[0];
}
调用:<input type="text" id="CTNWeight_1" name="CTNWeight" onkeyup="CheckNum(this)" class="easyui-textbox" style=" 150px; height: 28px;">
c# UrlEncode,UrlDecode
用 C# winform 处理 utf-8,gb2312编码转换方法
首先,在项目属性 的 应用程序——目标框架中,选择 .NET Framework 4
然后再添加引用——.NET 中选择 System.Web,在代码中也加引入 using System.Web;
接下来直接写代码:
1
2
3
4
|
HttpUtility.UrlEncode(text); //utf-8 编码 HttpUtility.UrlDecode(text); //utf-8 解码 HttpUtility.UrlEncode(text, System.Text.Encoding.GetEncoding(936)); //gb2312编码 HttpUtility.UrlDecode(text, System.Text.Encoding.GetEncoding(936)); //gb2312解码 |