Hello i am a new comer and this is my first thread post here is code -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.example.org">
<html xmlns="http://www.example.org">
<head>
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function a()
{
var a = parseFloat(document.getElementById('r1').value);
var b = parseFloat(document.getElementById('r2').value);
var e = parseFloat(document.getElementById('c').value);
if (e >= a && e <= b)
{
writetolog("Congratulations! You entered correct");
}
else
{
writetolog("Sorry Wrong");
c.select();
}
}
function writetolog(givenstring)
{
var txt = document.getElementById('txtarea1');
txt.innerHTML = txt.innerHTML + '\n' + givenstring;
}
</script></head>
<body>
<div>
Starting Range</div>
<input type="text" id="r1" style="width: 50px" />
<div>
Ending Range</div>
<input type="text" id="r2" style="width: 50px" />
<div>
Code</div>
<input type="text" id="c" style="width: 100px" />
<input type="button" value="GO" onclick="a()" />
<div id="txtarea1">
</div>
</textarea></body>
</html>
The Bold area is the important one here ive got to print the log in the div. The code is working correct but i have to color the log text how would i do it?