the following is working fine:
document.getElementById("comment").style.background=color
I'd like to add several IDs. The following do not work:
document.getElementById("comment, name, url").style.background=color
document.querySelectorAll("comment, name, url").style.background=color
Can someone suggest what code avoiding to write a new function to bind all the ids?
EDIT: This is the code I am working on: On the header I have:
<script>
function setbg(color)
{
document.getElementById("comment").style.background=color
}
</script>
And it styles well the following textarea:
<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4" required="" title="Mandatory field" onfocus="this.value=''; setbg('#e5fff3');" onblur="setbg('white')" placeholder="Add a comment here..." style="background-color: white; background-position: initial initial; background-repeat: initial initial;"></textarea></p>
But I'd like it to work also for:
<input type="text" name="url" id="url" value="" size="22" tabindex="3" placeholder="WWW" onfocus="this.value=''; setbg('#e5fff3');" onblur="setbg('white')">
As well as per other fields, like email, name, etc.