[thelist] JavaScript Select box validation style problem

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Fri Nov 5 11:39:37 CST 2004


Jay,

	Actually, it's

mm.options[mm.selectedIndex].style.background = backgroundColor;
mm.options[mm.selectedIndex].style.color = color;

	The syntax may be a little different for background...

Peter

-----Original Message-----
From: thelist-bounces at lists.evolt.org On Behalf Of Jay Fitzgerald

Yes, I found that placing borders around select boxes does not work...so

now I am trying to change the background color and font color of the 
first option in my select box if the validation fails:

function checkstep1()
{
    var mm = document.step1.mm;
    var backgroundColor = '#ff0000';
    var color = '#ffffff';

    if(mm.options[mm.selectedIndex].value = "00")
    {
        alert('Please select the month');
        mm.options[mm.selectedIndex].style = backgroundColor;
        mm.options[mm.selectedIndex].style = color;
        return false;
    }

but I am doing this correctly. It sortof validates the form because it 
gives the JS Alert box; but it still process the form and goes to the 
next page and it soent stop and set the background and font colors

Any help is appreciated.

Jay




More information about the thelist mailing list