Frage

this line renews the captcha image, it should clear the inputbox 'captcha' aswell.

    <div id="refresh_button"><a href="#" onclick="refreshimg();return false;"><img src="refresh.gif"/></a></div>

    <input type="text" maxlength="6" name="captcha" id="captcha" class="captcha_inputbox" />

So I have to modify the onClick, but I can't find this, not even with google.

Your help is much appreciated

War es hilfreich?

Lösung

You can clear out the textbox's value by using:

document.getElementById('captcha').value = '';

Alternatively, if you're using jQuery:

$('#captcha').val('');

Andere Tipps

it would be better to do this in script tags instead. For instance you can do something like this:

<script type='text/javascript'>
   function refreshimg() {
      // do the refreshing here

      // since your input text has an id of 'captcha'
      document.getElementById("captcha").value = "";

      return false;
   }
</script>

then in your HTML, you would do

<div id="refresh_button"><a href="#" onclick="return refreshimg();"><img src="refresh.gif"/></a></div>
<input type="text" maxlength="6" name="captcha" id="captcha" class="captcha_inputbox" />
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top