/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Captcha

how would I change the javascript code so that you do not have to click on the “Load New code” to refesh the image

what I am doing is if code does not match then you get a back button.
<center>
<form>
<input type=button value=”<< Go Back ” onClick=”history.go(-1)”></form>
</font></center>

[code]
<script language=”javaScript”>

function reloadCAPTCHA() {

document.getElementById(‘CAPTCHA’).src=’captcha.cgi?randomnumber?’+Date();

}

</script>

<a href=”javascript:reloadCAPTCHA();”>Load New Code</a>

[/code]

my main code is wrote in perl and the CAPTCHA comes from [url]http://www.bumblebeeware.com/captcha/[/url]

I do not want to reload the whole page just the CAPTCHA, hope this makes sence..

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@winracerauthorJul 07.2009 — tried both of these in the body
<i>
</i>&lt;body onload="java script:reloadCAPTCHA1()"&gt;

&lt;body onload="reloadCAPTCHA1()"&gt;




and had this in the head


<i>
</i>
&lt;script language="javaScript"&gt;

function reloadCAPTCHA1() {

<i> </i> document.getElementById('CAPTCHA').src='../../cap/captcha.cgi?randomnumber?'+Date();

}

&lt;/script&gt;



but still can not get to work
Copy linkTweet thisAlerts:
@winracerauthorJul 08.2009 — any help would be appreciated
Copy linkTweet thisAlerts:
@winracerauthorJul 08.2009 — I think I might I found what I did worng

I place all this in the <head>

<i>
</i>&lt;head&gt;
&lt;script language="javaScript"&gt;

function reloadCAPTCHA1() {

<i> </i> document.getElementById('CAPTCHA').src='../../cap/captcha.cgi?randomnumber?'+Date();

}

&lt;/script&gt;
&lt;body onload="reloadCAPTCHA1()"&gt;

&lt;/head&gt;


and I think it might be working I have to do more tests.

I thought the <body onload="reloadCAPTCHA1()"> went in the <body>
×

Success!

Help @winracer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...