<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
txtCount.Text = txtInput.MaxLength.ToString();
txtInput.Attributes.Add("onKeyUp","javascript:document.getElementById('" +txtCount.ClientID+"').setAttribute('value',("+txtInput.MaxLength+" - parseInt(document.getElementById('"+txtInput.ClientID+"').getAttribute('value').length)));");
}
public int MaxLength
{
get { return txtInput.MaxLength; }
set { txtInput.MaxLength = value; }
}
}
阅读(819) | 评论(0) | 转发(0) |