»
EnglishFrenchVietnamese

Print - Chmod Calculator script - JavaScriptBank.com

Full version: jsB@nk » Utility » Chmod Calculator script
URL: https://www.javascriptbank.com/chmod-calculator-script.html

Chmod Calculator script © JavaScriptBank.comThe chmod calculator code is the script to have handy when setting permissions on your cgi files via FTP. 755 anyone?

Full version: jsB@nk » Utility » Chmod Calculator script
URL: https://www.javascriptbank.com/chmod-calculator-script.html



CSS
<STYLE>#navbar A {FONT: bold 12px Verdana; COLOR: white}.footad A {FONT: 11px Verdana; TEXT-DECORATION: none}</STYLE><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<SCRIPT language=JavaScript>// Chmod calculator. This is useful when setting permissions on cgi files using FTP// Copyright Peter Crouch 2000. All rights reserved.function calculator(user, number){// Ownerif (user == "owner" && number == "4"){var box = eval("document.chmod.owner4")}if (user == "owner" && number == "2"){var box = eval("document.chmod.owner2")}if (user == "owner" && number == "1"){var box = eval("document.chmod.owner1")}// Groupif (user == "group" && number == "4"){var box = eval("document.chmod.group4")}if (user == "group" && number == "2"){var box = eval("document.chmod.group2")}if (user == "group" && number == "1"){var box = eval("document.chmod.group1")}// Otherif (user == "other" && number == "4"){var box = eval("document.chmod.other4")}if (user == "other" && number == "2"){var box = eval("document.chmod.other2")}if (user == "other" && number == "1"){var box = eval("document.chmod.other1")}if (box.checked == true){if (user == "owner"){document.chmod.h_owner.value += ("+number")var a= (document.chmod.h_owner.value)var b= eval(a)document.chmod.h_owner.value=bdocument.chmod.t_owner.value=b}if (user == "group"){document.chmod.h_group.value += ("+number")var a= (document.chmod.h_group.value)var b= eval(a)document.chmod.h_group.value=bdocument.chmod.t_group.value=b}if (user == "other"){document.chmod.h_other.value += ("+number")var a= (document.chmod.h_other.value)var b= eval(a)document.chmod.h_other.value=bdocument.chmod.t_other.value=b}}if (box.checked == false){if (user == "owner"){if (document.chmod.h_owner.value == ""){document.chmod.t_owner.value=""}else {var a=(document.chmod.h_owner.value);b=a-(number);c=eval(b);document.chmod.h_owner.value=cdocument.chmod.t_owner.value=c}}if (user == "group"){if (document.chmod.h_group.value == ""){document.chmod.t_group.value=""}else {var a=(document.chmod.h_group.value);b=a-(number);c=eval(b);document.chmod.h_group.value=cdocument.chmod.t_group.value=c}}if (user == "other"){if (document.chmod.h_other.value == ""){document.chmod.t_other.value=""}else {var a=(document.chmod.h_other.value);b=a-(number);c=eval(b);document.chmod.h_other.value=cdocument.chmod.t_other.value=c}}}}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
 <FORM name="chmod"><INPUT type=hidden name=h_owner> <INPUT type=hidden name=h_group> <INPUT type=hidden name=h_other> <TABLE cellSpacing=1 cellPadding=5 bgColor=#000000>  <TBODY>  <TR bgColor=#ffffff>    <TD colSpan=4><FONT face=verdana size=3><B>Chmod</B></FONT></TD></TR>  <TR align=middle bgColor=#ffffff>    <TD><FONT face=verdana size=-1><B>Permission</B></FONT></TD>    <TD><FONT face=verdana size=-1><B>Owner</B></FONT></TD>    <TD><FONT face=verdana size=-1><B>Group</B></FONT></TD>    <TD><FONT face=verdana size=-1><B>Other</B></FONT></TD></TR>  <TR align=middle bgColor=#ffffff>    <TD><FONT face=verdana size=-1><B>Read</B></FONT></TD>    <TD><INPUT onclick="calculator('owner', 4)" type=checkbox value=4       name=owner4></TD>    <TD><INPUT onclick="calculator('group', 4)" type=checkbox value=4       name=group4></TD>    <TD><INPUT onclick="calculator('other', 4)" type=checkbox value=4       name=other4></TD></TR>  <TR align=middle bgColor=#ffffff>    <TD><FONT face=verdana size=-1><B>Write</B></FONT></TD>    <TD><INPUT onclick="calculator('owner', 2)" type=checkbox value=2       name=owner2></TD>    <TD><INPUT onclick="calculator('group', 2)" type=checkbox value=2       name=group2></TD>    <TD><INPUT onclick="calculator('other', 2)" type=checkbox value=2       name=other2></TD></TR>  <TR align=middle bgColor=#ffffff>    <TD><FONT face=verdana size=-1><B>Execute</B></FONT></TD>    <TD><INPUT onclick="calculator('owner', 1)" type=checkbox value=1       name=owner1></TD>    <TD><INPUT onclick="calculator('group', 1)" type=checkbox value=1       name=group1></TD>    <TD><INPUT onclick="calculator('other', 1)" type=checkbox value=1       name=other1></TD></TR>  <TR align=middle bgColor=#ffffff>    <TD><FONT face=verdana size=-1><B></B></FONT></TD>    <TD><INPUT size=1 name=t_owner></TD>    <TD><INPUT size=1 name=t_group></TD>    <TD><INPUT size=1 name=t_other></TD></TR></TBODY></TABLE></FORM><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->