troubleshooting Question

create a captcha protection page

Avatar of newbie27
newbie27Flag for United Kingdom of Great Britain and Northern Ireland asked on
2 Comments1 Solution185 ViewsLast Modified:
Hello Experts,
I had a script to stop spam abuse on the website to some extent, but for some reason it is not working.
Can someone please look into this.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<script type="text/javascript">
 function init()
        var val = code()
 function Random(X) {
    return Math.floor(X * (Math.random() % 1));
 function code() {
    var j, S = ""; 
    for (j = 0; j < 3; j++) {
        S += String.fromCharCode(65 + Random(26));
        S += String.fromCharCode(97 + Random(26));
    return S;
    function validForm(frm){      
            var form_name = frm ;      
        var valid = true;      
        var errMsg = "";
        var emailFilter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;            
                  errMsg = "Please enter your name.";
                  valid = false;
                  errMsg= errMsg + "\n Please enter your e-mail address.";
                  valid = false;
            }else if (!(emailFilter.test( {
                  errMsg= errMsg + "\n Please enter a valid email address.";
                  valid = false;
                  errMsg= errMsg + "\n Please enter the subject.";
                  valid = false;
                  errMsg= errMsg + "\n Please enter your comments.";
                  valid = false;
            if(valid == false){                  
            return valid;
<p><strong>Fields marked with an <span style="color:Red">*</span> are required.</strong></p>
<td><input name="name" class="textfield" value="" id="Text1" type="text" /><span style="color:Red">*</span>
<td><input name="email" class="textfield" value="" id="Text2" type="text" /><span style="color:Red">*</span>
<td><p>Contact number</p></td>
<td><input name="contact" class="textfield" value="" id="Text3" type="text" />
<td><input name="city" class="textfield" value="" id="Text4" type="text" />
<td><select name="country" id="country" style="width:150">
<option value="UK"  selected="selected">United Kingdom</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="YU">Yugoslavia</option>
<option value="ZR">Zaire</option>
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option></select>
<td><input name="subjects" class="textfield" value="" id="Text5" type="text" /><span style="color:Red">*</span> 
<td><p>Your Comments</p></td>
<td><textarea name="comments" rows="8" cols="100" style="width: 300px; height: 100px" id="Textarea1"></textarea><span style="color:Red">*</span> 
<td colspan="2"> 
<td> </td>
<td><input name="send" value="Submit" id="Submit1" type="submit" />
                   <input value="Clear" id="Reset1" name="Reset1" type="reset" /></tbody></table></form></td></tr></tbody></table> 
<div>Code: <span  id="visibleCaptchar" style="border:1px solid black; background-color:beige;font-weight:bold;font-size:large;font-family:verdana;padding: 3px;"></span></div>
Please Enter code you see above:<input type="" name="userCaptcha" value=""/>
Julian Matz
Technical Support
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros