Hello
What is wrong in the form validation. It always give me -> not OK -> red color
I hope someone can help me with this.
Thanks in advance. Best regard.

<html>          
<head>
<style>
.error {
    font-family: Tahoma;
    font-size: 8pt;
    color: #FFFFFF;
    padding: 2px 172px 2px 172px;
    background-color: #FF0000;
    display:none;
    text-align: center;
}

.correct {
    font-family: Tahoma;
    font-size: 8pt;
    color: #FFFFFF;
    padding: 2px 203px 2px 203px;
    background-color: #0c9f5b;
    display:none;
    text-align: center;
}

.error_captcha {
    font-family: Tahoma;
    font-size: 8pt;
    color: #FFFFFF;
    padding: 2px 133px 2px 133px;
    background-color: #FF0000;
    display:none;
    text-align: center;
}

.correct_captcha {
    font-family: Tahoma;
    font-size: 8pt;
    color: #FFFFFF;
    padding: 2px 203px 2px 203px;
    background-color: #0c9f5b;
    display:none;
    text-align: center;
}

</style>
<!-- Captcha -->
    <script type="text/javascript">
        <!-- Begin
            var a = Math.ceil(Math.random() * 10 + 2);
            var b = Math.ceil(Math.random() * 10 + 2);       
            var c = a + b
            function DrawBotBoot()
            {
                document.write("<span id='captcha' style='font-size:12px;'>"+a + " + " + b +" = <span>");
                document.write("<input type='text' name='captcha' id='captcha' maxlength='2' size='2' />");
            }    
        // End -->
    </script>

<!-- Form validation -->
<script type="text/javascript">
function formulierValidation()
{
    var d = document.getElementById("captcha").value;

    //captcha
    if((d !== c) || (d = ""))
        {
            hideAllErrors();
            var obj = document.getElementById("captchaCorrect");
                obj.removeAttribute('style');
            document.getElementById("captchaError").style.display = "inline";
            document.getElementById("ErrorCaptcha").style.color = "red";
            document.getElementById('captcha').focus();
            return false;
        } else {
            hideAllErrors();
            var obj = document.getElementById("captchaError");
                obj.removeAttribute('style');
            document.getElementById("captchaCorrect").style.display = "inline";
            document.getElementById("ErrorCaptcha").style.color = "green";
        }       


    // Clear Errorsfields
    function hideAllErrors() 
    {
        document.getElementById("captchaError").style.display = "none"
    }
}
// -->
</script>

        </head>
        <body>


        <form name="formulier" method="post" action="<?=$self?>" onclick="formulierValidation();">

        <span id="ErrorCaptcha"><b>code</b><span>
        <script type="text/javascript">DrawBotBoot()</script> <span id="ErrorCaptcha"></span>
        <span class="error_captcha" id="captchaError">ccde invullen.</span><span class="correct_captcha" id="captchaCorrect">Ok.</span>
        <input type="button" value="submit" class="button" />
        </form>

SOLVED

Thanks you all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.