Форма для подключения по FTP.

Данный скрипт реализует форму для подключения вашего браузера к выбранному FTP-серверу (надписи выделенные зеленым необходимо откорректировать).
 

Код.

<script language="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('You Must Enter A Username And A Password \n Before You May Continue');
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>

Форма:

<form name="form">
User Login:
<input type="radio" name="logtype" value="user" checked>
Anonymous Login:
<input type="radio" name="logtype" value="anon">
Username:
<input type="text" name="user" size=15 OnFocus="window.status=('Now Enter A Username')" OnBlur="window.status=('');">
Password:
<input type="password" name="pass" size=15 OnFocus="window.status=('Now Enter A Password')" OnBlur="window.status=('')">
Varify Input:
Yes <input type="radio" name="verify" value="yes" checked>
No <input type="radio" name="verify" value="no">

Window Options

Location:
Yes <input type="radio" name="locbar" value="yes">
No <input type="radio" name="locbar" value="no" checked>
Buttons:
Yes <input type="radio" name="butbar" value="yes" checked>
No <input type="radio" name="butbar" value="no">
Menu Bar:
Yes <input type="radio" name="menbar" value="yes" checked>
No <input type="radio" name="menbar" value="no">
Status Bar:
Yes <input type="radio" name="statbar" value="yes" checked>
No <input type="radio" name="statbar" value="no">

<input type="text" name="host" value="www.site_name.ru" size=30>
<input type="button" name="scroll" value="Соединиться" OnFocus="window.status=('Click To Log On To My FTP')" OnBlur="window.status=('')" onClick="logType(this.form)">
</form>

 

Результат.


User Login: 
Anonymous Login: 
Username:Password:
Varify Input:Yes No  

Window Options
Location:Yes No Buttons:Yes No
Menu Bar:Yes No Status Bar:Yes No
             

Назад