wsj0413 / kaptcha

Automatically exported from code.google.com/p/kaptcha
Other
0 stars 0 forks source link

Can't Re-genarate image #63

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Click the image
2.
3.

What is the expected output? Re-generate image

What do you see instead? The same image, browser showing error

What version of the product are you using? 2.3.2
On what operating system? Windows Server 2003

Please provide any additional information below.
Here is the jsp code, everything seems to work except the jquery. I played 
around with src and the image and can't make it to work.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <%@ page language="java" contentType="text/html; charset=UTF-8" %>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Kaptcha Example</title>
    </head>
    <body>

        Enter in the <a href="http://code.google.com/p/kaptcha/">Kaptcha</a> to see if it matches what is stored in the session attributes.

        <table>
            <tr>
                <td><img src="kaptcha.jpg" name="kaptchaImage" id="kaptchaImage"></td>
                <td valign="top">

                    <form method="POST">
                        <br>sec code:<input type="text" name="kaptchafield"><br />
                        <input type="submit" name="submit">
                    </form>
                </td>
            </tr>
        </table>

        <br /><br /><br /><br />

        <%
            String c = (String)session.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
            String parm = (String) request.getParameter("kaptchafield");

            out.println("Parameter: " + parm + " ? Session Key: " + c + " : ");

            if (c != null && parm != null) {
                if (c.equals(parm)) {
                    out.println("<b>true</b>");
                } else {
                    out.println("<b>false</b>");
                }
            }
        %>

    </body>
</html>

<script type="text/javascript">
    $(function(){
        $('#kaptchaImage').click(function () { 
            $(this).attr('src', '/kaptcha.jpg?' + Math.floor(Math.random()*100) );
        })
}); </script>                                 

Thank you.

Original issue reported on code.google.com by Man...@gmail.com on 6 Sep 2011 at 7:37

GoogleCodeExporter commented 8 years ago
Sorry, this isn't a support forum. Please ask on the mailing list.

Original comment by latch...@gmail.com on 6 Sep 2011 at 9:50