GetDotted Domains

Viewing Thread:
"A little JavaScript/CSS help, if you can."

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.

Mon 13/10/03 at 17:50
Regular
"It goes so quickly"
Posts: 4,083
Hi all, hope everyone is well.

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
Mon 13/10/03 at 20:45
Regular
"Twenty quid."
Posts: 11,452
Could you adapt the code given here (it's for a mouse over highlight) ...

http://www.dynamicdrive.com /dynamicindex11/highlighttable.htm

... ?
Mon 13/10/03 at 20:11
Regular
"Pouch Ape"
Posts: 14,499
I know that in IE you can just give a cell a name and then do "document.tablecell.bgColor=whatever", but I doubt it works in Netscape. Setting "tablecell" in that as a variable and then linking to a variable name in the "()" bit also works, but again - only in IE!
Mon 13/10/03 at 17:50
Regular
"It goes so quickly"
Posts: 4,083
Hi all, hope everyone is well.

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

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Thank you very much for your help!
Top service for free - excellent - thank you very much for your help.
Brilliant service.
Love it, love it, love it!
Christopher

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.