I have a text box that gets its name, id, and value from a SQL query.
PHP Code:
echo "<input type='text' id=" $row['ID'] . "field" $counter " name=" $row['ID'] . "field" $counter " value='" $response['I' $counter] . "' style='width:12px' onblur='upperCase(this.id,this.value,correct" $counter ".value);' onload='upperCase(this.id,this.value,correct" $counter ".value);'>" 
When a response is typed into the box and the user advances to the next, the function upperCase(id,answer,correct) capitalizes the user's input and then checks the input against the correct response (stored in a hidden input whose value is pulled from a SQL query). If the response is correct, the box's background color changes:
Code:
function upperCase(id,answer,correct){
		var x=document.getElementById(id).value
		document.getElementById(id).value=x.toUpperCase()
		if(answer.toUpperCase() == correct.toUpperCase()){
			document.getElementById(id).style.background = "#00FF00" //green
		}
		else {
			document.getElementById(id).style.background = "#FF0000" //red
		}
	}
My problem is that when the page loads with the values from the SQL query, I want all of the text boxes to run their upperCase function to change their respective background colors and I cannot figure out how to do this when the correct responses and initial text box values are set from the SQL query.

I thought I was genius when I put the onload event in there (which obviously doesnt work with an input element). I need an alternative solution. Please help!