如果您喜歡這些文章,歡迎點擊此處訂閱本Blog

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

帶驗證碼的Flex登錄窗口實例代碼

系統 1695 0
<!-- Feedsky FEED發布代碼開始 --> 如果您喜歡這些文章,歡迎點擊此處訂閱本Blog <!-- FEED自動發現標記開始 --> <link title="RSS 2.0" type="application/rss+xml" rel="alternate"> <!-- FEED自動發現標記結束 --> Blog 訂閱

<!--Google 468*60橫幅廣告開始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "image"; //2007-07-26: CSDN google_ad_channel = "6063905817"; google_color_border = "6699CC"; google_color_bg = "E6E6E6"; google_color_link = "FFFFFF"; google_color_text = "333333"; google_color_url = "AECCEB"; google_ui_features = "rc:6"; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--Google 468*60橫幅廣告結束-->

本例子是實現了一個網頁登錄窗口的驗證程序,具有驗證碼功能:
  1. <? xml version = "1.0" encoding = "utf-8" ?>
  2. < mx:Application xmlns:mx = "http://www.adobe.com/2006/mxml" layout = "absolute" creationComplete = "initApp()" >
  3. < mx:states >
  4. <!--新建“index”State-->
  5. < mx:State name = "index" >
  6. <!--移除“登錄框”-->
  7. < mx:RemoveChild target = "{panel1}" />
  8. <!--添加新的組件-->
  9. < mx:AddChild position = "lastChild" >
  10. < mx:Label x = "231" y = "174" text = "歡迎來到主頁" fontFamily = "Georgia" fontSize = "20" />
  11. </ mx:AddChild >
  12. </ mx:State >
  13. </ mx:states >
  14. < mx:Script >
  15. <![CDATA[
  16. importmx.controls.Alert;
  17. privatefunctioninitApp():void
  18. {
  19. //顯示校驗碼
  20. lblCheckCode.text=GenerateCheckCode();
  21. }
  22. privatefunctionloginHandle():void
  23. {
  24. //空的情況
  25. if(txtUsername.text==""||txtPassword.text=="")
  26. {
  27. Alert.show("請輸入完整數據!");
  28. }
  29. else
  30. {
  31. //合法用戶
  32. if(txtUsername.text=="Administrator"&&txtPassword.text=="123456"&&txtCheckCode.text.toLocaleLowerCase()==lblCheckCode.text.toLowerCase())
  33. {
  34. currentState="index";
  35. }
  36. //登錄失敗
  37. else
  38. {
  39. //校驗碼錯誤
  40. if(txtCheckCode.text.toLowerCase()!=lblCheckCode.text.toLowerCase())
  41. {
  42. Alert.show("校驗碼錯誤!");
  43. //重新生成校驗碼
  44. lblCheckCode.text=GenerateCheckCode();
  45. }
  46. //用戶名或密碼錯誤
  47. else
  48. Alert.show("用戶名或密碼錯誤!");
  49. }
  50. }
  51. }
  52. privatefunctionresetHandle():void
  53. {
  54. txtUsername.text="";
  55. txtPassword.text="";
  56. txtCheckCode.text="";
  57. }
  58. //生成隨機碼
  59. privatefunctionGenerateCheckCode():String
  60. {
  61. //初始化
  62. varran:Number;
  63. varnumber:Number;
  64. varcode:String;
  65. varcheckCode:String="";
  66. //生成四位隨機數
  67. for(vari:int=0;i<4;i++)
  68. {
  69. //Math.random生成數為類似為0.1234
  70. ran=Math.random();
  71. number=Math.round(ran*10000);
  72. //如果是2的倍數生成一個數字
  73. if(number%2==0)
  74. //"0"的ASCII碼是48
  75. code=String.fromCharCode(48+(number%10));
  76. //生成一個字母
  77. else
  78. //"A"的ASCII碼為65
  79. code=String.fromCharCode(65+(number%26));
  80. checkCode+=code;
  81. }
  82. returncheckCode;
  83. }
  84. ]]>
  85. </ mx:Script >
  86. < mx:Panel x = "337.5" y = "261" width = "349" height = "257" layout = "absolute" title = "用戶登錄" fontFamily = "Georgia" fontSize = "12" id = "panel1" >
  87. <!--"用戶名"標簽-->
  88. < mx:Label x = "41.5" y = "33" text = "用戶名" />
  89. <!--"密碼"標簽-->
  90. < mx:Label x = "42.5" y = "81" text = "密碼" />
  91. <!--"用戶名"輸入框-->
  92. < mx:TextInput x = "94.5" y = "33" id = "txtUsername" />
  93. <!--"密碼"輸入框-->
  94. < mx:TextInput x = "95.5" y = "81" id = "txtPassword" displayAsPassword = "true" />
  95. <!--"登錄"按鈕-->
  96. < mx:Button x = "82.5" y = "159" label = "登錄" id = "btnLogin" click = "loginHandle()" />
  97. <!--"重置"按鈕-->
  98. < mx:Button x = "181.5" y = "159" label = "重置" id = "btnReset" click = "resetHandle()" />
  99. <!--"校驗碼"標簽-->
  100. < mx:Label x = "165.5" y = "125" id = "lblCheckCode" width = "42.5" color = "#377CD0" />
  101. < mx:LinkButton x = "216" y = "123" label = "看不清楚?" id = "linkbtnReGenerate" click = "lblCheckCode.text=GenerateCheckCode();" fontFamily = "Georgia" fontSize = "11" />
  102. < mx:Label x = "39.5" y = "123" text = "校驗碼" />
  103. <!--"校驗碼"輸入框-->
  104. < mx:TextInput x = "96.5" y = "121" id = "txtCheckCode" width = "61" maxChars = "4" />
  105. </ mx:Panel >
  106. </ mx:Application >
轉自: http://www.joelove.cn/

<!--新Google 468*60橫幅廣告開始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x60, 創建于 08-8-6 */ google_ad_slot = "7368701459"; google_ad_width = 468; google_ad_height = 60; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--新Google 468*60橫幅廣告結束-->

<!--新Google 468x15 橫鏈接單元開始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x15 橫鏈接單元 */ google_ad_slot = "5785741422"; google_ad_width = 468; google_ad_height = 15; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--新Google 468x15 橫鏈接單元結束-->

<!-- Google Reader shared發布代碼開始 --><script type="text/javascript" src="http://www.google.com/reader/ui/publisher.js"></script><script type="text/javascript" src="http://www.google.com/reader/public/javascript/user/00697638153916680411/state/com.google/broadcast?n=5&amp;callback=GRC_p%28%7Bc%3A%22green%22%2Ct%3A%22%5Cu8FD9%5Cu4E9B%5Cu6587%5Cu7AE0%5Cu4E5F%5Cu503C%5Cu5F97%5Cu4E00%5Cu770B%22%2Cs%3A%22false%22%7D%29%3Bnew%20GRC"></script><!-- Google Reader shared發布代碼結束 -->

帶驗證碼的Flex登錄窗口實例代碼


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 榆中县| 齐河县| 祁东县| 泾源县| 灯塔市| 湘乡市| 扎兰屯市| 随州市| 土默特右旗| 绥芬河市| 都昌县| 沾化县| 邻水| 平塘县| 社旗县| 蒲江县| 安陆市| 安化县| 齐河县| 旬邑县| 甘洛县| 吉安县| 银川市| 塔河县| 宁国市| 墨脱县| 勃利县| 岳阳市| 陆良县| 延寿县| 色达县| 九龙坡区| 台中市| 奉贤区| 南投市| SHOW| 环江| 依兰县| 通化市| 射阳县| 徐州市|