Скрипт
Code
<script type="text/javascript">
function logType(form) {
var url = ("ftp://"+form.host.value+"/")
if(form.logtype[0].checked == true) {
checkPass(form)
}
if((form.logtype[1].checked == true) && (form.verify[1].checked == true)) {
openFtp(form,url)
}
if((form.logtype[1].checked == true) && (form.verify[0].checked == true)) {
if(confirm("Now Loggin On To " + url + " anonymously")) {
openFtp(form,url)
}
}
}
function checkPass(form) {
var ip = (form.host.value)
var user = (form.user.value)
var pass = (form.pass.value)
var uspass = (user + ":" + pass)
var url = ("ftp://" +uspass+ "@" +ip)
if((form.user.value == "") && (form.pass.value == "")) {
alert('Вы должны ввести Имя пользователя и пароль \n Прежде чем вы можете продолжить!');
document.form.user.focus()
}
if((form.user.value == "") && (form.pass.value != "")) {
alert('Enter A Username!');
document.form.user.focus()
}
if((form.pass.value == "") && (form.user.value != "")) {
alert('Enter A Password!');
document.form.pass.focus()
}
if((form.pass.value != "") && (form.user.value != "") && (form.verify[0].checked == true)) {
if(confirm("Now Loggin On To ftp://" + ip + "/ Using \n Username: " + user + " \n Password: " + pass + "")) {
openFtp(form,url)
}
}
if((form.pass.value != "") && (form.user.value != "") && (form.verify[1].checked == true)) {
openFtp(form,url)
}
}
function openFtp(form,url) {
var locbar = ("no")
var butbar = ("no")
var menbar = ("no")
var statbar = ("no")
if(form.statbar[0].checked == true) {
statbar = "yes"
}
if(form.menbar[0].checked == true) {
menbar = "yes"
}
if(form.butbar[0].checked == true) {
butbar = "yes"
}
if(form.locbar[0].checked == true) {
locbar = "yes"
}
window.open(url, "", "resizable=yes,location=" + locbar + ",toolbar=" + butbar + ",scrollbars=yes,menubar=" + menbar + ",status=" + statbar + "")
}
</script>
Форма:
Code
<form name="form" action="/">
User Login:
<input type="radio" name="logtype" value="user" checked>
<br />
Anonymous Login:
<input type="radio" name="logtype" value="anon">
<br />
Username:
<input type="text" name="user" size=15 OnFocus="window.status=('Теперь введите Имя пользователя')" OnBlur="window.status=('');">
<br />
Password:
<input type="password" name="pass" size=15 OnFocus="window.status=('Теперь введите пароль')" OnBlur="window.status=('')">
<br />
Varify Input:
Yes <input type="radio" name="verify" value="yes" checked>
No <input type="radio" name="verify" value="no">
<br />
<strong>Window Options</strong>
<br />
Location:
Yes <input type="radio" name="locbar" value="yes">
No <input type="radio" name="locbar" value="no" checked>
<br />
Buttons:
Yes <input type="radio" name="butbar" value="yes" checked>
No <input type="radio" name="butbar" value="no">
<br />
Menu Bar:
Yes <input type="radio" name="menbar" value="yes" checked>
No <input type="radio" name="menbar" value="no">
<br />
Status Bar:
Yes <input type="radio" name="statbar" value="yes" checked>
No <input type="radio" name="statbar" value="no">
<br />
<input type="text" name="host" value="ftp.coool.net.ru" size=30>
<input type="button" name="scroll" value="Соединиться" OnFocus="window.status=('Нажмите, чтобы войти на мой FTP')" OnBlur="window.status=('')" onClick="logType(this.form)">
</form>