function SetCookie(cookieName, cookieValue, nHours)
{
var today = new Date();
var expire = new Date();
if( nHours == null || nHours == 0 )
nHours = 1;
expire.setTime( today.getTime() + 3600000*nHours ); //milisekundy!*/
document.cookie = cookieName+"="+escape(cookieValue)+";expires="+expire.toGMTString();
}
function getCookie( cookieName )
{
var cookies = document.cookie;
var pos = cookies.indexOf( cookieName );
if( pos == -1 || cookieName == "" )
return "";
var pos2 = cookies.indexOf( ';' , pos );
if( pos2 == -1 )
pos2 = cookies.length;
return unescape( cookies.substring( pos+cookieName.length+1 , pos2 ) );
}
function qwe()
{
SetCookie( "shout", document.getElementById( "myShout" ).value, 1 );
}
function ewq()
{
document.getElementById( "myShout" ).value = getCookie( "shout" );
}
<input type="text" name="shout_input" onKeyUp="qwe();" id="myShout" value="" />
przepisz to jakoś najlepiej ;p
może zamiast godzin daj minuty (albo np 0.25 godziny)