0
Hello! I need a code that changes the background of some Textbox as soon as the page is loaded according to what was "taken" from the database, my idea would be as follows: the textbox has 2 possible values = "SENT" and "NOT SENT", the code changes the background to Green(SENT) or red(NOT SENT). I don’t know much about 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 short 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 supposing they were described ai, how would it be? I couldn’t find but if there are any similar or similar questions, could you give me the link?
@Leocaracciolo :DD... I know not, I think your computer has bugged.. appearing things that do not exist
– Sam
is vdd I think it’s hungry, I’m going to lunch :D
– user60252
see that if you remove the function, it will give even result
– user60252
@Yes, but since he put a function in the question, I think it’s best to keep it.
– Sam