[thelist] JavaScript Select box validation style problem

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Fri Nov 5 14:53:15 CST 2004


	You need to use == instead of = for comparison.  The single
equality sign is an assignment operator in Javascript.

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

Both of these worked - Thank you

But now, even when I choose an option from the list other than the 
selectedIndex of 0; it still gives the alert.

Jay

Peter Brunone (EasyListBox.com) wrote:

>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
>
>
>  
>


-- 
Jay Fitzgerald, Design Director
. Certified Professional Webmaster (CPW-A)
. Certified Professional Web Designer (CPWDS-A)
. Certified Professional Web Developer (CPWDV-A)
. Certified E-Commerce Manager (CECM-A)
. Certified Small Business Web Consultant (CWCSB-A)

Bayou Internet - http://www.bayou.com
Toll Free: 888.30.BAYOU (22968)
Vox: 318.338.2034 / Fax: 318.338.2506
E-Mail: jayfitz at bayou.com

ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf


-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 




More information about the thelist mailing list