Hi guys,wats up?
so i am trying to make this short script that will toggle my text from upper case to lowercase and from lowercase to upper case… so if i wrote HeLlO wOrLd, my script will output hElLo WoRlD. I have gave it many tries but i am just not getting it, can someone who knows what he’s doing help me out, thx! Here is a sample of my noob code:
<html>
<head>
<script type=”text/javascript”>
function togglecase(){
var theinput=document.getElementById(“output”).value;
if (theinput == theinput.toUpperCase()){
theinput.value.toLowercase();
}
else if (theinput == theinput.toLowerCase()){
theinput.value.toUpperCase();
}
}
</script>
<body>
<form>
<input type=”checkbox” onClick=”togglecase()”/>Toggle Case<br />
<input type=”text” id=”output” />
<!–Oh yeah i forgot to mention that i want my input and output to be in a textbox and the checkbox will change it (no need to toggle back and forth just once is good enough, basic script is all i need)–>
</form>
</body>
</html>
Thanks!