Ciao.
Prova questo è tirato via ma
funziona (l'alert è l'unico modo
che ho trovato per sistemare
la cosa che si complica
lasciando la possibilità al guest di
cancellare la tua scritta )
Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript" type="text/JavaScript">
window.onload = function()
{
document.getElementById("myinput").onkeyup = function()
{
var nodelete = document.getElementById("myinput").value;
if(nodelete.length < 6)
{
document.getElementById("myinput").value = "name :";
alert("Please don't delete name : ;))) ");
}
document.getElementById("myinput").onblur = function()
{
var valore = document.getElementById("myinput").value;
var tmp = valore.length + 6;
var valoreGuest = valore.substring(0,tmp);
if(valore.indexOf("name :") == -1)
{
document.getElementById("myinput").value = "name :" + valoreGuest;
}
}
}
}
</script>
</head>
<body>
<form action="action.php" method="get">
<input name="myinput" type="text" value="name :" />
</form>
</body>
</html>