Created
October 22, 2016 22:18
-
-
Save slice/c613c94a5618fc0727885d8835228939 to your computer and use it in GitHub Desktop.
EVEN MORE code from 2013. Starting out in JavaScript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSExercises | |
// TextDisable | |
<html> | |
<body> | |
<font face="Courier"> | |
<font size=5> | |
<p> | |
TextDisable - HTML+JScript Exercise | |
</p> | |
</font> | |
<input id="tb" type="text"> | |
<input id="tbcs" type="text" disabled=1> | |
<br> | |
<button onclick="disabledOn()">Disabled TRUE</button> | |
<button onclick="disabledOff()">Disabled FALSE | |
</button> | |
</font> | |
</body> | |
<script> | |
function disabledOn() | |
{ | |
document.getElementById("tb").disabled=1 | |
document.getElementById("tbcs").value="Disabled" | |
} | |
function disabledOff() | |
{ | |
document.getElementById("tb").disabled=0 | |
document.getElementById("tbcs").value="Editable" | |
} | |
</script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TextLock- By Ryan T.- Tidy V1 | |
<html> | |
<font face="Courier"> | |
<title> | |
Text Locker | |
</title> | |
<font size=7> | |
Text Locker <br> | |
</font> | |
<i> Enter text below and click on "Lock" to choose a password and lock out the text box.</i> | |
<textarea rows=4 id="ta" cols=90> | |
</textarea> | |
<br> | |
<button id="lb" type="button" onclick="lockTa()">Lock</button> | |
<button id="ub" type="button" onclick="unlockTa()">Unlock</button> | |
</font> | |
<script> | |
// FUNCTIONS AND SUCH | |
function clearTa() | |
{ | |
document.getElementById("ta").value="" | |
} | |
function lockTa() | |
{ | |
pwrd=prompt("What shall be the password?") | |
enccota=document.getElementById("ta").value | |
document.getElementById("ta").value="" | |
document.getElementById("ta").disabled=1 | |
document.getElementById("lb").disabled=1 | |
document.getElementById("ub").disabled=0 | |
locked=1 | |
} | |
function unlockTa() | |
{ | |
tpwrd=prompt("What is the password?") | |
if (tpwrd==pwrd) { | |
document.getElementById("ta").value=enccota | |
document.getElementById("ta").disabled=0 | |
document.getElementById("ub").disabled=1 | |
document.getElementById("lb").disabled=0 | |
alert("Unlocked successfully!") | |
locked=0 | |
} else { | |
alert("Incorrect password!") | |
} | |
} | |
</script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TextLocker- By Ryan T.- Tidy V 2.0.1 | |
<html> | |
<script> | |
initFunction() | |
</script> | |
<font face="Courier"> | |
<title> | |
Text Locker | |
</title> | |
<font size=7> | |
Text Locker <br> | |
</font> | |
<i> Enter text below and click on "Lock" to choose a password and lock out the text box.</i> | |
<textarea rows=4 id="ta" cols=90> | |
</textarea> | |
<br> | |
<button id="lb" type="button" onclick="lockTa()">Lock</button> | |
<button id="ub" type="button" onclick="unlockTa()" disabled=1>Unlock</button> | |
<button id="rta" onclick="clearTa()">Reset Textbox</button> | |
</font> | |
<script> | |
// FUNCTIONS AND SUCH | |
function initFunction() | |
{ | |
document.getElementById("ub").disabled=1 | |
} | |
function clearTa() | |
{ | |
document.getElementById("ta").value="" | |
} | |
function lockTa() | |
{ | |
pwrd=prompt("What shall be the password?") | |
enccota=document.getElementById("ta").value | |
document.getElementById("ta").value="" | |
document.getElementById("ta").disabled=1 | |
document.getElementById("lb").disabled=1 | |
document.getElementById("ub").disabled=0 | |
document.getElementById("rta").disabled=1 | |
locked=1 | |
} | |
function unlockTa() | |
{ | |
tpwrd=prompt("What is the password?") | |
if (tpwrd==pwrd) { | |
document.getElementById("ta").value=enccota | |
document.getElementById("ta").disabled=0 | |
document.getElementById("ub").disabled=1 | |
document.getElementById("lb").disabled=0 | |
document.getElementById("rta").disabled=0 | |
alert("Unlocked successfully!") | |
locked=0 | |
} else { | |
alert("Incorrect password!") | |
} | |
} | |
</script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TextLocker- By Ryan T.- Tidy V2 | |
<html> | |
<font face="Courier"> | |
<title> | |
Text Locker | |
</title> | |
<font size=7> | |
Text Locker <br> | |
</font> | |
<i> Enter text below and click on "Lock" to choose a password and lock out the text box.</i> | |
<textarea rows=4 id="ta" cols=90> | |
</textarea> | |
<br> | |
<button id="lb" type="button" onclick="lockTa()">Lock</button> | |
<button id="ub" type="button" onclick="unlockTa()">Unlock</button> | |
<button id="rta" onclick="clearTa()">Reset Textbox</button> | |
</font> | |
<script> | |
// FUNCTIONS AND SUCH | |
function clearTa() | |
{ | |
document.getElementById("ta").value="" | |
} | |
function lockTa() | |
{ | |
pwrd=prompt("What shall be the password?") | |
enccota=document.getElementById("ta").value | |
document.getElementById("ta").value="" | |
document.getElementById("ta").disabled=1 | |
document.getElementById("lb").disabled=1 | |
document.getElementById("ub").disabled=0 | |
document.getElementById("rta").disabled=1 | |
locked=1 | |
} | |
function unlockTa() | |
{ | |
tpwrd=prompt("What is the password?") | |
if (tpwrd==pwrd) { | |
document.getElementById("ta").value=enccota | |
document.getElementById("ta").disabled=0 | |
document.getElementById("ub").disabled=1 | |
document.getElementById("lb").disabled=0 | |
document.getElementById("rta").disabled=1 | |
alert("Unlocked successfully!") | |
locked=0 | |
} else { | |
alert("Incorrect password!") | |
} | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment