Funziona solo nei browser recenti, mentre quelli piu` vecchi hanno sintassi diverse:

var ttt = document.getElementById('testo').innerHTML;

Ciao
Michele