﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-tacimoto-随笔分类-javascript &amp; Ajax</title><link>http://www.cnitblog.com/tacimoto/category/4627.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 01 Oct 2011 00:57:46 GMT</lastBuildDate><pubDate>Sat, 01 Oct 2011 00:57:46 GMT</pubDate><ttl>60</ttl><item><title>一个生成验证码内容的小方法</title><link>http://www.cnitblog.com/tacimoto/archive/2007/01/04/21497.html</link><dc:creator>bismarck</dc:creator><author>bismarck</author><pubDate>Thu, 04 Jan 2007 04:51:00 GMT</pubDate><guid>http://www.cnitblog.com/tacimoto/archive/2007/01/04/21497.html</guid><wfw:comment>http://www.cnitblog.com/tacimoto/comments/21497.html</wfw:comment><comments>http://www.cnitblog.com/tacimoto/archive/2007/01/04/21497.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/tacimoto/comments/commentRss/21497.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/tacimoto/services/trackbacks/21497.html</trackback:ping><description><![CDATA[&lt;!-- <br />//--------------------------随机字符-------------------------- <br />//str_0 长度 <br />//str_1 是否大写字母 <br />//str_2 是否小写字母 <br />//str_3 是否数字 <br />function rnd_str(str_0,str_1,str_2,str_3) <br />{ <br />var Seed_array=new Array(); <br />var seedary; <br />var i; <br /><br />Seed_array[0]="" <br />Seed_array[1]= "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; <br />Seed_array[2]= "a b c d e f g h i j k l m n o p q r s t u v w x y z"; <br />Seed_array[3]= "0 1 2 3 4 5 6 7 8 9"; <br /><br /><br />if (!str_1&amp;&amp;!str_2&amp;&amp;!str_3){str_1=true;str_2=true;str_3=true;} <br /><br />if (str_1){Seed_array[0]+=Seed_array[1];} <br />if (str_2){Seed_array[0]+=" "+Seed_array[2];} <br />if (str_3){Seed_array[0]+=" "+Seed_array[3];} <br /><br />Seed_array[0]= Seed_array[0].split(" "); <br />seedary="" <br />for (i=0;i&lt;str_0;i++) <br />{ <br />seedary+=Seed_array[0][Math.round(Math.random( )*(Seed_array[0].length-1))] <br />} <br />return(seedary); <br /><br />} <br />--&gt; <br /><br /><br />//--------------------调用时-------------- <br /><br />&lt;script language="JavaScript" type="text/JavaScript"&gt; <br />var obj=document.all.jz_4; <br />var tmp=rnd_str(6,true,true,true); <br />obj.value=tmp; <br />document.write(tmp); <br />&lt;/script&gt; <br /><img src ="http://www.cnitblog.com/tacimoto/aggbug/21497.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/tacimoto/" target="_blank">bismarck</a> 2007-01-04 12:51 <a href="http://www.cnitblog.com/tacimoto/archive/2007/01/04/21497.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>