functie verificare cod din text box
Scris: Vin Oct 14, 2011
Salut... vreau sa fac o verificare dar nu prea imi iese
Functie JS:
Formular:
Problema e ca rezultatul e mereu acelasi... adica incorect desi il pun corect.
Functie JS:
Cod: Selectaţi tot
function verific(code) {
var capcha = document.getElementById("capcha").value;
var code = document.getElementById("code").innerHTML;
if (capcha == code) {
document.getElementById('notification').style.display = 'hidden';
}
else {
document.getElementById('notification').style.display = 'inline';
}
}
Cod: Selectaţi tot
<?php
print "Cod securitate: ";
$md5 = md5(microtime() * mktime());
$string = substr($md5,0,5);
$_SESSION['capcha']=$string;
$code=$_SESSION['capcha'];
print " <span id='code'>";
print $_SESSION['capcha'];
print "</span>";
print "<br/>";
print "<input type='text' name='capcha' id='capcha' size='10' onkeyup=\"verific()\">";
print "<span id='notification' style='display:none; color: red; weight: bold;'> Codul de securitate este incorect!</span>";
print "<br/><br/>";
?>