[thelist] need js function to toggle uppercase lowercase of selection

Stuart Young syoung at unitec.ac.nz
Mon Jul 19 21:01:05 CDT 2004


--------------------
I have a browser-based text editor (contenteditable), and would like
to
enable a keyboard shortcut to toggle the current selection's text to
upper/lowercase. Any suggestions?
--------------------


function upperMe() {
	document.converter.output.value =
document.converter.input.value.toUpperCase()
}

function lowerMe() {
	document.converter.output.value =
document.converter.input.value.toLowerCase()
}

This function transforms text into UPPERCASE or lowercase:<br>
<FORM NAME="converter">
<b>Input text:</b> <INPUT TYPE="text" NAME="input" VALUE="type text
here"><BR>
<b>Ouput text:</b> <INPUT TYPE="text" NAME="output" VALUE=" "><BR><BR>
<INPUT TYPE="button" VALUE="UPPERCASE please" onClick="upperMe()"><BR>
<INPUT TYPE="button" VALUE="lowercase please" onClick="lowerMe()">
</FORM>


Dr Stuart Young,       +64 (0)9-815 4321 Ex 8656
<syoung at unitec.ac.nz>     
Lecturer, School of Computing and Information Technology,
Unitec New Zealand, Auckland, New Zealand
http://hyperdisc.unitec.ac.nz/staff/syoung.htm
I would provide a URL for my official staffpage, but its too long and
complex


More information about the thelist mailing list