Basta che usi il onmouseover ed il onmouseout:
html:
JScodice:<style type="text/css"> .Styled{ height: 20px; } .Styled label{ width: 150px; float: left; } </style> <div class = "Styled"> <label id = "Testo"> Il Mio Testo </label> <input type="text" name="myText" id = "TextID" /> </div>
Codice PHP:var TestoDaCambiare = "Inserisci Qui il tuo Testo";
var TestoOriginale = "Il Mio Testo";
var changeTextInLabel = function(labelElem, testo){
labelElem.innerHTML = testo;
}
window.onload = function(){
var inpt = document.getElementById("TextID");
inpt.onmouseover = function(){
var label = document.getElementById("Testo");
changeTextInLabel(label, TestoDaCambiare);
}
inpt.onmouseout = function(){
var label = document.getElementById("Testo");
changeTextInLabel(label, TestoOriginale);
}
}

Rispondi quotando