ok, I have a input type="text" and when I type in it, I want my div to follow the exact value of my input. However, my div is always one character back. So If I type "ARGH" ... my div says "ARG"

the form
<form action="" method="post">
<input id="searchtext" type="text" value="" onkeypress="autocomplete(this.value, event);">
the js function
function autocomplete(thevalue, e) {

theObject = document.getElementById("superdiv");

var key = e.which

if(key == undefined){
key = e.keyCode;  

theObject.innerHTML = thevalue;