用.net寫Textbox控件關於數字的判斷的二則方法

方法1、使用textboxSelected事件進行判斷首界面源碼以下:html

<!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>
    <table>
        <tr>
            <td align="right" style="height: 31px">請輸入你的消費金額:</td>
            <td style="height: 31px"><asp:TextBox ID="txtMonthPuy" runat="Server" class="textbox" Width="150" AutoPostBack="True" OnTextChanged="txtMonthPuy_TextChanged"></asp:TextBox>
            <span style="COLOR: #ff0000">*$</span>
            </td>
        </tr>
    </table>
    </div>
    </form>
</body>
</html>

首界面效果以下:spa

後臺源碼以下:調試

調試代碼顯示以下:code

相關文章
相關標籤/搜索