Hello, just having a little trouble with the use of the toLowerCase() function. My project is to edit text in a text area. I have a basic change colour function which gets the user to put either red, blue, green or yellow into it to a
textbox. It usessome if statements, which was working fine until I added the toLowerCase() function. Here is my
code.
for JavaScript:
function changeColour() {
var color = document.forms["myForm2"]["myTextBox"].value;
colour = color.toLowerCase();
if(colour == "red") {
document.myForm1.myTextArea.style.color ="red";
} else if (colour == "blue") {
document.myForm1.myTextArea.style.color ="blue";
} else if (colour == "green") {
document.myForm1.myTextArea.style.color ="green";
} else if (colour == "yellow") {
document.myForm1.myTextArea.style.color ="yellow";
} else { alert("Please enter red, blue green or yellow")
}
Bookmarks