Allora, parto da 0, ho questo script che mi permette in poche parole di far comparire a fianco del mouse un div e questo div inseguirà il mouse finché si ritroverà al di sopra di questo input, fuori scomparirà. Io vorrei che quando andassi su questo input mi comparisse appunto il contenuto di una variabile, una funzione, il problema è che mi da il seguente errore nel ciclo del while della variabile ($tip)
codice:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\EASYPHP\www\stato.php on line 148
Codice PHP:
<script>
var oTooltip = new (function() {
var nOverX, nOverY, nLeftPos, nTopPos, oNode, bOff = true;
this.follow = function (oMsEvnt1) {
if (bOff) { return; }
if (!oMsEvnt1) { oMsEvnt1 = window.event; }
var nMoveX = oMsEvnt1.clientX, nMoveY = oMsEvnt1.clientY;
nLeftPos += nMoveX - nOverX; nTopPos += nMoveY - nOverY;
oNode.style.left = nLeftPos + "px";
oNode.style.top = nTopPos + "px";
nOverX = nMoveX; nOverY = nMoveY;
};
this.remove = function () {
if (bOff) { return; }
bOff = true; document.body.removeChild(oNode);
};
this.append = function (oMsEvnt2, sTxtContent) {
if (!oMsEvnt2) { oMsEvnt2 = window.event; }
oNode.innerHTML = sTxtContent;
if (bOff) { document.body.appendChild(oNode); bOff = false; }
var nScrollX = document.documentElement.scrollLeft || document.body.scrollLeft, nScrollY = document.documentElement.scrollTop || document.body.scrollTop, nWidth = oNode.offsetWidth, nHeight = oNode.offsetHeight;
nOverX = oMsEvnt2.clientX; nOverY = oMsEvnt2.clientY;
nLeftPos = document.body.offsetWidth - nOverX - nScrollX > nWidth ? nOverX + nScrollX + 10 : document.body.offsetWidth - nWidth + 16;
nTopPos = nOverY - nHeight > 6 ? nOverY + nScrollY - nHeight - 7 : nOverY + nScrollY + 20;
oNode.style.left = nLeftPos + "px";
oNode.style.top = nTopPos + "px";
};
this.init = function() {
oNode = document.createElement("div");
oNode.setAttribute("class", "tooltip");
oNode.style.position = "absolute";
};
})();
</script>
Questo è l'input:
Codice PHP:
(...)
$stato ="<form method='POST' id='box15'>
<input type='submit' name='piu' value='+' id='piu' class='btn2'
onmouseout=\"this.className = 'btn2'; oTooltip.remove();\"
onmouseover=\"this.className = 'btn3'; oTooltip.append(event, '$tip');\" /*QUI*/
onmousemove=\"oTooltip.follow(event);\"/>
</form>
";
(...)
Questa è la variabile:
Codice PHP:
$tip = "
$sdb;
$sql = 'SELECT * FROM stato WHERE ID=$id';
$query = mysql_query($sql);
$nrw = mysql_num_rows($query);
while ($nrw = mysql_fetch_assoc($query)) {
$piu = $nrw['PIU'];
$nom = $nrw['NOME'];
$cog = $nrw['COGNOME'];
echo $nom.' '.$cog.'
';
}
";
CHIEDO SCUSA, CREDEVO CHE IL PROBLEMA FOSSE QUALCOSA DI VELOCE E BANALE.