zoukankan      html  css  js  c++  java
  • flex4.5生成验证码


     1 <?xml version="1.0" encoding="utf-8"?>
     2 <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
     3                xmlns:s="library://ns.adobe.com/flex/spark" 
     4                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
     5     <fx:Declarations>
     6         <!-- Place non-visual elements (e.g., services, value objects) here -->
     7     </fx:Declarations>
     8     <fx:Script>
     9         <![CDATA[
    10             //生成验证码
    11             private function createVerificationCode():String
    12             {
    13                 var numRandom:Number;
    14                 var number:Number;
    15                 var str:String = "";
    16                 var strVerificationCode:String="";
    17                 for(var i:int = 0; i < 6; i++)
    18                 {
    19                     numRandom = Math.random();                    
    20                     number = Math.round(numRandom*1000);                    
    21                     if(number % 2 == 0)
    22                     {
    23                         str = String.fromCharCode(48 + (number % 10));                        
    24                     }
    25                     else
    26                     {
    27                         str = String.fromCharCode(65 + (number % 26));
    28                     }
    29                     strVerificationCode +=str;
    30                 }
    31                 return strVerificationCode;
    32             }
    33         ]]>
    34     </fx:Script>
    35     <s:Label id="lblCode" text="{createVerificationCode()}" />
    36 </s:Application>
  • 相关阅读:
    Installshield 添加应用程序到防火墙例外
    服务器表导入到本地数据库SQL语句
    【转】13个JavaScript图表(JS图表)图形绘制插件
    【转】20个简化开发任务的 JavaScript库
    【转】8 个效果惊人的 WebGL/JavaScript 演示
    【转】JavaScript 3D图表
    VMware显示错误:“未能锁定文件 无法打开磁盘 ..*.vmdk 或者某一个快照所依赖的磁盘。”解决办法
    Spring HTTP invoker简介
    【转】在Ubuntu下建立Eclipse的Android开发环境
    【转】在NetBeans上搭建Android SDK环境
  • 原文地址:https://www.cnblogs.com/sange/p/2396506.html
Copyright © 2011-2022 走看看