I have this code that replaces text entered in a box
Code:
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script>
function replaceText(){
// witth is not a spelling error, you cant
// use with for a variable name
// create array of replace objects
var rep =[
{replace : "cat", witth : "hat"},
{replace : "dark", witth : "light"}
], // declare the rest of the variables
i,
// get value of the textarea
text=document.getElementById("txt").value,
// return text is now the value of the textarea
returnText=text;
// for every object in the rep (replace) array
for(i=0;i<rep.length;i++){
// replace "replace" with "witth" using
// rep array
returnText=returnText.replace(new RegExp(
rep[i].replace,"igm"),rep[i].witth);
}
// set value of the text area
document.getElementById("txt").value=returnText
}
</script>
</head>
<body >
<textarea id="txt">The dark cat.</textarea>
<input type="button" onclick="replaceText();" value="Replace"/>
</body>
</html>
Now I need to style it!!!
I really only need to center it and move the "replace" button below, but If you also know how i would like to have the text area black, the text inside the replace button white, the button background black, the button border square and the button border white!
I am a beginner to css and i'm very confused!
If you only know how to do one of the listed styles that's fine! If it only looks a bit better, well, that's an improvement!
Thanks for your time!