<!--
- 功能: 生成随机密码
- 输入: 用户的设置
- 输出: 随机密码,同时拷贝到剪切板
- 作者: maskx
- 版本: v1.0
- 历史纪录: 2007-7-11新建
- 创建时间: 2007-7-11
- 最后修改时间:2007-7-11
-->
<html>
<head>
<title>Password Creator</title>
<hta:application id="objHTAPasswordCreator" applicationname="HTAPasswordCreator" scroll="no"
singleinstance="yes">
</head>
<style>
BODY
{}{
background-color: buttonface;
font-family: Helvetica;
font-size: 10pt;
margin-top: 10px;
margin-left: 20px;
margin-right: 20px;
margin-bottom: 10px;
}
</style>
<script language="VBScript">
'生成随机密码
Function UserGetPassword()
Dim strPassword
Dim strAll,pwdLen
Randomize
strAll=""
pwdLen=0
if ckUpper.checked then
strAll= strAll & "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
end if
if ckLower.checked then
strAll= strAll & "abcdefghijklmnopqrstopwxyz"
end if
if ckNum.checked then
strAll= strAll & "0123456789"
end if
if ckSpecial.checked then
strAll= strAll & "~!@#$%^&*()_+[]\;',./{}|:<>?"
end if
if strAll="" then
MsgBox "请选择密码内容"
exit function
end if
if RDConst.checked then
pwdLen=cmbConstLen.selectedIndex+1
else
if cmbHeigh.selectedIndex < cmbLow.selectedIndex then
MsgBox "密码长度最大值应该大于最小值"
exit function
end if
pwdLen=Int((cmbHeigh.selectedIndex - cmbLow.selectedIndex + 1)) * Rnd + cmbLow.selectedIndex +1
end if
strPassword=RoundStr(strAll,pwdLen)
TxtPWD.Value=strPassword
document.parentwindow.clipboardData.SetData "text", strPassword
End Function
Function RoundStr( str,Num)
s = ""
for i = 1 to Num
Randomize
strLen = Len(str)
t = Round((RND * (strLen-1))+1)
s = s & Mid(str,t,1)
Next
RoundStr = s
End Function
</script>
<body>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center">
点击"生成密码"按钮 <br/> 在生成密码的同时也将密码拷贝进剪切板
<br/><br/>
</td>
</tr>
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="width: 114px; height: 18px">
密码内容</td>
<td style="height: 18px">
<input id="ckNum" checked="checked" type="checkbox" />数字
</td>
<td style="height: 18px">
<input id="ckLower" checked="checked" type="checkbox" />小写字母
</td>
</tr>
<tr>
<td style="width: 114px; height: 20px">
</td>
<td style="height: 20px">
<input id="ckSpecial" checked="checked" type="checkbox" />特殊字符</td>
<td style="height: 20px">
<input id="ckUpper" checked="checked" type="checkbox" />大写字母</td>
</tr>
<tr>
<td style="width: 114px">
密码长度</td>
<td>
<input id="RDConst" type="radio" checked="CHECKED" name="pwdLen" />固定长度</td>
<td>
<select id="cmbConstLen">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option selected="selected">8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
</select>
</td>
</tr>
<tr>
<td style="width: 114px">
</td>
<td>
<input id="RDRandm" type="radio" name="pwdLen" />变化长度</td>
<td>
<select id="cmbLow">
<option>1</option>
<option selected="selected">2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
</select>
-
<select id="cmbHeigh">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option selected="selected">11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<br /><br />
<table>
<tr>
<td>
<input type="text" name="TxtPWD" width="100%" style="width: 209px"></td>
<td>
<input id="btnCreatePWD" class="button" type="button" value="生成密码" name="btnCreatePWD"
onclick="UserGetPassword">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
- 功能: 生成随机密码
- 输入: 用户的设置
- 输出: 随机密码,同时拷贝到剪切板
- 作者: maskx
- 版本: v1.0
- 历史纪录: 2007-7-11新建
- 创建时间: 2007-7-11
- 最后修改时间:2007-7-11
-->
<html>
<head>
<title>Password Creator</title>
<hta:application id="objHTAPasswordCreator" applicationname="HTAPasswordCreator" scroll="no"
singleinstance="yes">
</head>
<style>
BODY
{}{
background-color: buttonface;
font-family: Helvetica;
font-size: 10pt;
margin-top: 10px;
margin-left: 20px;
margin-right: 20px;
margin-bottom: 10px;
}
</style>
<script language="VBScript">
'生成随机密码
Function UserGetPassword()
Dim strPassword
Dim strAll,pwdLen
Randomize
strAll=""
pwdLen=0
if ckUpper.checked then
strAll= strAll & "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
end if
if ckLower.checked then
strAll= strAll & "abcdefghijklmnopqrstopwxyz"
end if
if ckNum.checked then
strAll= strAll & "0123456789"
end if
if ckSpecial.checked then
strAll= strAll & "~!@#$%^&*()_+[]\;',./{}|:<>?"
end if
if strAll="" then
MsgBox "请选择密码内容"
exit function
end if
if RDConst.checked then
pwdLen=cmbConstLen.selectedIndex+1
else
if cmbHeigh.selectedIndex < cmbLow.selectedIndex then
MsgBox "密码长度最大值应该大于最小值"
exit function
end if
pwdLen=Int((cmbHeigh.selectedIndex - cmbLow.selectedIndex + 1)) * Rnd + cmbLow.selectedIndex +1
end if
strPassword=RoundStr(strAll,pwdLen)
TxtPWD.Value=strPassword
document.parentwindow.clipboardData.SetData "text", strPassword
End Function
Function RoundStr( str,Num)
s = ""
for i = 1 to Num
Randomize
strLen = Len(str)
t = Round((RND * (strLen-1))+1)
s = s & Mid(str,t,1)
Next
RoundStr = s
End Function
</script>
<body>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center">
点击"生成密码"按钮 <br/> 在生成密码的同时也将密码拷贝进剪切板
<br/><br/>
</td>
</tr>
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="width: 114px; height: 18px">
密码内容</td>
<td style="height: 18px">
<input id="ckNum" checked="checked" type="checkbox" />数字
</td>
<td style="height: 18px">
<input id="ckLower" checked="checked" type="checkbox" />小写字母
</td>
</tr>
<tr>
<td style="width: 114px; height: 20px">
</td>
<td style="height: 20px">
<input id="ckSpecial" checked="checked" type="checkbox" />特殊字符</td>
<td style="height: 20px">
<input id="ckUpper" checked="checked" type="checkbox" />大写字母</td>
</tr>
<tr>
<td style="width: 114px">
密码长度</td>
<td>
<input id="RDConst" type="radio" checked="CHECKED" name="pwdLen" />固定长度</td>
<td>
<select id="cmbConstLen">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option selected="selected">8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
</select>
</td>
</tr>
<tr>
<td style="width: 114px">
</td>
<td>
<input id="RDRandm" type="radio" name="pwdLen" />变化长度</td>
<td>
<select id="cmbLow">
<option>1</option>
<option selected="selected">2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
</select>
-
<select id="cmbHeigh">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option selected="selected">11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<br /><br />
<table>
<tr>
<td>
<input type="text" name="TxtPWD" width="100%" style="width: 209px"></td>
<td>
<input id="btnCreatePWD" class="button" type="button" value="生成密码" name="btnCreatePWD"
onclick="UserGetPassword">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>