I created a registration page so that the java function would be coupled to the "/" symbol. example typing 20 the java docked "/" = > 20 / entering 2 more digits = > 20/12 / filtering to the default date 20/13/2017. but after typing the month nothing happened. What's wrong?
<fontcolor="orange" size="4">Data:<font><p></p>
<input type="text" required maxlength="10" id="data" onkeyup="datajs()" placeholder="dia/mes/ano" />
<script>
function datajs(){
data = document.getElementById("data").value;
var dia = data.substr(0,2);
var mes = data.substr(2,3);
var ano = data.substr(5,4);
var data1 = data.substr(2,1);
var data2 = data.substr(5,1);
if (data1 != "/") {
if( data.length >= 3 ) {
if( data.length <= 4 ) {
document.forms[0].data.value = dia+'/'+mes;
}
}
}
if(data2 != "/") {
if( data.length > 5 ) {
if( data.length <= 10 ) {
document.forms[0].data.value = dia+mes+'/'+ano;
}
}
}
}
</script>
<style>
#data {