I have a password generator for registrations on the site, I want to convert it into a link generator for my site, so that when I click on "generate", I open a new page and display a link with the generated address of the form: http://*****.ру/
(generator value)
<SCRIPT language="JavaScript" SRC="1.js"></SCRIPT> <center> <table width=80% border=0> <tr align=center> <td> <form name="myform"> <table border=0> <tr> <td bgcolor="#B7DADB"> 1-й элемент может быть: </td> <td bgcolor="#B7DADB"> <input type=checkbox name=firstNumber checked>Цифра <input type=checkbox name=firstLower checked>Прописная <input type=checkbox name=firstUpper checked>Заглавная <input type=checkbox name=firstOther>Другие элементы </td> </tr> <tr> <td bgcolor="#D4D4D4"> Последующие элементы: </td> <td bgcolor="#D4D4D4"> <input type=checkbox name=latterNumber checked>Цифра <input type=checkbox name=latterLower checked>Прописная <input type=checkbox name=latterUpper checked>Заглавная <input type=checkbox name=latterOther>Другие элементы </td> </tr> <tr> <td bgcolor="#999999"> Длина пароля: </td> <td bgcolor="#999999"> <input type=text name=passwordLength value="8" size=3> </td> </tr> <tr> <td bgcolor="#999999"> Доп. элементы: </td> <td bgcolor="#999999"> <input type=text name=extraChars size=20> </td> </tr> </font> <tr> <td bgcolor="#999999"> <font size="4" color="#FFFFFF">Новый пароль: </font> </td> <font size="4" color="#FF0000"> <td bgcolor="#999999"> <font size="4" color="#FF0000"> <input type=text name=password size=20> </font> </td> </tr> <tr> <td bgcolor="#999999"> </td> <td bgcolor="#999999"> <font size="4" color="#FF0000"><input type=button value="Сгенерировать пароль" onClick="document.myform.password.value = getPassword(document.myform.passwordLength.value, document.myform.extraChars.value, document.myform.firstNumber.checked, document.myform.firstLower.checked, document.myform.firstUpper.checked, document.myform.firstOther.checked, document.myform.latterNumber.checked, document.myform.latterLower.checked, document.myform.latterUpper.checked, document.myform.latterOther.checked);" style="font-size: 8pt; font-family: Arial"> </font> </td> </tr> </table> </td> </tr> </table> </center>
1.js
function getRandomNum(lbound, ubound) { return (Math.floor(Math.random() * (ubound - lbound)) + lbound); } function getRandomChar(number, lower, upper, other, extra) { var numberChars = "0123456789"; var lowerChars = "abcdefghijklmnopqrstuvwxyz"; var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var otherChars = "`~!@#$%^&*()-_=+***91;{***93;}\\|;:'\",<.>/? "; var charSet = extra; if (number == true) charSet += numberChars; if (lower == true) charSet += lowerChars; if (upper == true) charSet += upperChars; if (other == true) charSet += otherChars; return charSet.charAt(getRandomNum(0, charSet.length)); } function getPassword(length, extraChars, firstNumber, firstLower, firstUpper, firstOther, latterNumber, latterLower, latterUpper, latterOther) { var rc = ""; if (length > 0) rc = rc + getRandomChar(firstNumber, firstLower, firstUpper, firstOther, extraChars); for (var idx = 1; idx < length; ++idx) { rc = rc + getRandomChar(latterNumber, latterLower, latterUpper, latterOther, extraChars); } return rc; }
All that is needed from the code is that it opens a new page and displays a page with the value of the generator. Thank you in advance.
http://i32^dF{.ru
? Can you explain more intelligibly? - ling