The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
Just a quick question, to anyone who is able to help me out.
I've got a simple form, which includes JavaScript validation. When the user misses out a field, an alert will pop-up, and the focus will be on that field.
This works fine, but I would also like to make the background table row a different colour, to highlight it more-so.
At the moment, my code is:
function validate() {
if (document.survey.name.value.length == 0) {
window.alert("Please enter your Name before sending in this survey.");
document.survey.name.focus();
return false;
}
return true;
}
The table is set up like this:
| Your name: |
Would anybody be able to tell me the JavaScript code to set the table row with the ID of row1 to, say, 'pink' when the alert box comes up??
I've tried a few things, but either get an error, or nothing happens. I've been leaning towards something like this:
document.getElementById("Row1").bgcolor = 'pink';
... and other variations of this, but nothing works.
Any help would be great, thanks.
- Chris
http://www.dynamicdrive.com /dynamicindex11/highlighttable.htm
... ?
Just a quick question, to anyone who is able to help me out.
I've got a simple form, which includes JavaScript validation. When the user misses out a field, an alert will pop-up, and the focus will be on that field.
This works fine, but I would also like to make the background table row a different colour, to highlight it more-so.
At the moment, my code is:
function validate() {
if (document.survey.name.value.length == 0) {
window.alert("Please enter your Name before sending in this survey.");
document.survey.name.focus();
return false;
}
return true;
}
The table is set up like this:
| Your name: |
Would anybody be able to tell me the JavaScript code to set the table row with the ID of row1 to, say, 'pink' when the alert box comes up??
I've tried a few things, but either get an error, or nothing happens. I've been leaning towards something like this:
document.getElementById("Row1").bgcolor = 'pink';
... and other variations of this, but nothing works.
Any help would be great, thanks.
- Chris