Non va..
Richiamo così nell' HTML:
codice:
<body onLoad="caratteri(); stats-reload('email@domain.it');">
Il js (completo):
codice:
function caratteri() {
var e = document.getElementById('message').value.length;
var rimasti = 400-e;
if(rimasti == -1) {
document.getElementById('charater').innerHTML="0";
} else {
document.getElementById('charater').innerHTML=rimasti;
}
}
function conta_ch() {
if(document.getElementById('message').value.length > 400) {
document.getElementById('message').value = document.getElementById('message').value.substring(0,400);
}
}
function textarea_effect() {
$("#message").animate({
"height" : "95px"
},
"fast",
"linear"
);
}
function textarea_noeffect() {
if(document.getElementById('message').value.length == 0) {
$("#message").animate({
"height" : "20px"
},
"fast",
"linear"
);
}
}
function checkRows(oKeyEvent, oField, nRows) {
return oKeyEvent.keyCode !== 13 || (oField.value.match(/\n/g) || "").length < nRows - 1;
}
function stats(email) {
$.ajax({
type: "POST",
url: "stats.php",
data: "email="+email,
success: function(risul){
document.getElementById('list-stats').innerHTML=risul;
}
});
}
function stats-reload(email)
{
setInterval("stats(\""+email+"\")", 10000);
}
Il div list-stats:
codice:
<div id="list-stats">
contenuto
</div>