Zdravim,
Mam taky maly problem s ktorym sa kaslem uz dlho a furt nic tak pisem o radu...
Spravil som si funkciu ktora po prejdeni mysou po spane napise do inputu napovedu k tomu na co uzivatel ukazal....lenze problem je v tom ze NEfunguje zavolanie funkcie pomocou onmouseover....respektive zistil som ze ked sa ten span nachadza mimo formulara tak to funguje ale ked je vo formulari tak uz nie....neviete ako by sa to dalo okaslat?
js funkcia
function napoveda(typ)
{
set = document.addNew.napoveda;
switch(typ)
{
case "bold": set.value = "Bold text - text";
break;
case "italic": set.value = "Italic text - [i]text[/i]";
document.addNew.text.focus();
document.addNew.text.value=
document.addNew.text.value+"[i][/i]";
break;
case "underline": set.value = "Underline text - text";
break;
case "url": set.value = "Insert url - [url=http://link]text[/url]";
break;
case "img": set.value = "Insert image - ";
break;
case "quote": set.value = "Quote text - [q]text[/q]";
break;
case "smile": set.value = "Click to choose your smile";
break;
default: set.value = "";
}
}
html
<span onmouseover="napoveda('italic');" style="font-weight: bold; margin-left:10px;">B</span>//span mimo formulara - funkcia sa v poriadnku vykona
<div style="width:590px; height: auto; margin:auto;">
<div style="height: 35px; background-image:url('.$predpona.'grafika/hornaLista.png);"><div style="height:auto; text-align:center; position:relative; top: 13px; font-weight:bold;">'.$nadpis.'</div></div>
<div style="height:auto; background-color:#000000;">
<div style="height: 300px;">
<form name="addNew" method="post">
<table align="center" cellpadding="0" style="margin: auto">
<tr>
<td style="padding-top: 10px;">'.$subject.'</td><td><input type="text" name="predmet" value="" size="35" class="form" /></td>
</tr>
<tr>
<td colspan=2><input type="text" name="napoveda" value="" size="50" readonly="readonly" style="border: none; background: none; color: #AECFF8; cursor: default; font-size: 10px;" /></td>
</tr>
<tr>
<td colspan=2>
<div style="height: 16px; background-image:url('.$predpona.'grafika/bbCode/bbLista.png)">
<span onmouseover="napoveda(\'italic\');" style="font-weight: bold; margin-left:10px;">B</span>//tu je span vo formulari - funkcia sa nezavola! :-(
<span name="italic" style="font-style: italic; margin-left:10px;">I</span>
<span name="underline" style="text-decoration: underline; margin-left:10px;">U</span>
<span name="url" style="margin-left:10px;">url</span>
<span id="img" style="margin-left:10px;">img</span>
<span name="quote" style="margin-left:10px;">Q</span>
<span name="smile" style="margin-left:10px;">:-)</span>
</div>
<textarea style="height: 200px; margin-top: 0;" name="text" cols="75" class="form"></textarea>
</td>
</tr>
</table>
<div style="text-align:center;"><input type="submit" name="submit" value="'.$_submit.'" class="form" /></div>
</form>
</div>
</div>
<div style="height: 18px; background-image:url('.$predpona.'grafika/dolnaLista.png)"></div>
</div>