function v_code(){
//生成采购商验证ID----- start-------
$length= 8;
$chars1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$chars2 = '0123456789';
$max1 = strlen($chars1) - 1;
$max2 = strlen($chars2) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < 2; $i++) {
$card .= $chars1[mt_rand(0, $max1)];
}
for($i = 0; $i < 6; $i++){
$card .= $chars2[mt_rand(0, $max2)];
}
//生成完毕----- end -------
echo $card;
}
<tr class="verifyID_y">
<th><em class="red">*</em><{t}>生成验证ID:<{/t}></th>
<td><{input type="text" name="verifyID" vtype="required" class="inputstyle" id="verifyID" }></td>
<td><input type="button" value="生成验证ID" οnclick="vCode()"></td></tr>
function vCode(){ new Request({ url:'index.php?app=b2c&ctl=admin_member&act=v_code', onSuccess:function(res) { $('verifyID').value = res; } }).post(); }