Remove hide button from show in show/hide div script
Found this great script, it has button that show contents of div when clicked and the button changes to hide div button.
it starts all over with show div button on page load so works great.
my problem is i donīt need the second button
my plan is using it in combination of captcha script,
where captcha is hidden until user clicks button, hoping making it harder for bots.
and others that make fake registrations.
i already have integrated captcha script that generate the captcha
and its that div i hide with the script.
think my solution can benefit all that is using captcha adding extra layer of security to it,
at least i hope it does :)
Code:
<script type="text/javascript">
var button_beg = '<button id="button" onclick="showhide()">', button_end = '</button>';
var show_button = 'Show captcha', hide_button = 'Hide captcha';
function showhide() {
var div = document.getElementById( "hide_show" );
var showhide = document.getElementById( "showhide" );
if ( div.style.display !== "none" ) {
div.style.display = "none";
button = show_button;
showhide.innerHTML = button_beg + button + button_end;
} else {
div.style.display = "block";
button = hide_button;
showhide.innerHTML = button_beg + button + button_end;
}
}
function setup_button( status ) {
if ( status == 'show' ) {
button = hide_button;
} else {
button = show_button;
}
var showhide = document.getElementById( "showhide" );
showhide.innerHTML = button_beg + button + button_end;
}
window.onload = function () {
setup_button( 'hide' );
showhide(); // if setup_button is set to 'show' comment this line
}
</script>
<div id="showhide"></div>
<div id="hide_show">captcha</div>
i have tried lots of scripts but its only one i could find that works close to what i want
and spend couple of hours trying solving it my self but i cant figure it out.