I recommend that you stop denying with pure javascript and install some libraries like JQuery in the alternative and not so cumbersome way.
Usually ASPX elements when drawn in HTML end with the ID changed
<asp:Button ID="re" runat="server" autopostback="True" OnClick="re_Click" OnClientClick="return comprueba();" style="height: 32px" Text="Registrate" />
so a call for example to instantiate that button via id, placing it as it was named would not work:
$("#re")
but instead you can use a regular pseudo expression to matchearlo to work.
$("[id$='re']")
said that given a textbox let's say the following, if it is an html component, either of the two forms will work if it is an asp component, use the second to reference, and to change the background color it would be:
$("#elementId").css('background-color', "#f00000")
Finally an example using jquery:
function cambiarColor(elementId) {
$('#' + elementId).css('background-color', '#F00');
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="textbox">
<button type="button" onclick="cambiarColor('textbox')">cambiar color</button>