input[disabled] {
border: 1px solid #999;
background-color: #ddd;
}
input[disabled] {
border: 1px solid #999;
background-color: #ddd;
}
alert(‘<asp:Localize ID="EmailFomatInvalid" runat="server" meta:resourcekey="EmailFomatInvalid" />’, ‘lbl_email’);
在资源文件中定义各种语言的文本内容即可
function FormatTime(jsonDate,formatString) {
jsonDate = jsonDate.split('(')[1].split(')')[0];
var rDate = new Date(parseInt(jsonDate));
return rDate.format(formatString);
}
function FormatTime(jsonDate,formatString) {
jsonDate = jsonDate.split('(')[1].split(')')[0];
var rDate = new Date(parseInt(jsonDate));
return rDate.format(formatString);
}
Page Method 方式
如果不想独立创建Web Service,而只是希望能够调用页面上的一些方法,那么可以采用Page Method的的方法。同样的我们添加一个页面PageMethodDemo.aspx,增加一些JavaScript和一个后台方法,注意这个方法必须 是静态方法,代码如下:
<script type="text/javascript">
function PageMethodCall()
{
var testString = "PageMethodCall";
PageMethods.Test($get('txtName').value, OnSucceeded);
}
// 页面方法调用完成的回调函数.
function OnSucceeded(result)
{
// 显示调用结果
var RsltElem = document.getElementById("Results");
RsltElem.innerHTML = result;
}
</script>
<form id="form1">
<h2>Page Method</h2>
<input id="txtName" type="text" />
<button id="Button1">调用Page Method</button>
</form>
代码页PageMethodDemo.aspx.cs
[System.Web.Services.WebMethod]
public static string Test(string name)
{
return "Hello " + name + "!";
}
<input id="otxt" type="text" />
<script>
function onSub(){
alert('验证');
}
var timer =null
document.getElementById('otxt').onkeyup =function(){
clearTimeout(timer);
timer = setTimeout(onSub, 2000);
}
</script>
Email: