Hello! I need a code that changes the background of some TextBox as soon as the page is loaded according to what was "caught" from the database, my idea would be: textBox has 2 possible values="SENT" and " NOT SENT ", the code changes the background to Green (SENT) or red (NOT SENT). I do not understand much of Javascript but I tried this and there was no success:
<script type="text/javascript">
function ChangeColor() {
var cor = document.getElementById("cxtexto");
if (cor == "ENVIADO")
obj.style.backgroundColor = "#FF4D00";
else
obj.style.backgroundColor = "#0a719c";
}
</script>
In a very brief way my PHP / html page is as follows:
<html>
<body onload="ChangeColor()">
<head>
**Aqui vem o Script citado acima**
</head>
<td>JANEIRO<input type='text' value='ENVIADO' id='cxtexto'></td>
<td>FEVEREIRO<input type='text' value='NAO ENVIADO' id='cxtexto'></td>
</body>
</html>
The VALUES above it pulls from the database (with PHP) but assuming they were described there, what would it be like? I did not find it but if there were any similar or similar questions, could you give me the link?