Originalmente inviato da
dreadnaut
si ma non si può fare in html?
ho provato con questo codice, ma non funziona
Codice HTML:
<form name="modulo">
<textarea name="messaggio" id="messaggio" rows="10" cols="100"></textarea>
</form>
<a href="javascript:AddToTextarea('messaggio', ':-)')">:-)</a>
<a href="javascript:AddToTextarea('messaggio', ';-)')">;-)</a>
<a href="javascript:AddToTextarea('messaggio', ':-(')">:-(</a>
edit:
Ciao... io ho uno script html che inserisce il testo nella textare quando schiaccio su un bottone oppure testo... ecco il codice:
Codice HTML:
<form name="modulo" id="modulo" method="post" action="">
<div OnClick="document.modulo.messaggio.value+='1'">Michele Sassi </div>
<div OnClick="document.modulo.messaggio.value+='2'">Mario Rossi </div>
<div OnClick="document.modulo.messaggio.value+='3'">Alessandro Bianchi </div> </p>
<textarea name="messaggio" cols="50" rows="8" id="messaggio"></textarea>
<input type="submit" name="Submit" value="Invia" />
</form>
Il codice funziona correttamente, ma quando lo inserisco nel questo form, non funziona più:
Codice PHP:
<?
print<<<EOF
<style type="text/css">
div#usernotes {
background-color: transparent;
}
div#usernotes div.head, div#usernotes div.foot {
background-color: transparent;
padding: 4px;
}
div#usernotes div.foot {
text-align: right;
}
div#usernotes div.foot a, div#usernotes div.head a {
background-color: transparent;
}
div#usernotes span.action {
float: right;
}
div#usernotes div.note {
margin-left: 2em;
margin-right: 2em;
border-bottom:1px dashed;
padding: 4px;
}
div#usernotes div.text {
padding: 2px;
margin-top: 4px;
}
</style>
<div id="usernotes">
<div class="head"></div>
EOF;
if ($comments_count) {
for($i=0; $i<$comments_count; $i++) {
if ($dont_show_email[$i] != '1' && $email != '') { $author[$i] = "<a href=\"mailto:{$email[$i]}\">{$author[$i]}</a>"; }
$text[$i] = str_replace(chr(13), '<br />', $text[$i]);
$text[$i] = str_replace("[lol]", "<img src=\"http://forum.it.altervista.org/images/smilie/icon_wink.gif\" alt=\"alternativa_img\" />", $text[$i]);
print<<<EOF
<table width="600" border="0" align="center" ><td>
<font color='000099'><strong>{$author[$i]}</strong></font><br><small>{$time[$i]}</small>
<table><td style="border:2px solid #FFFFCC;" bgcolor='#FFFFCC' >
{$text[$i]}
</td></table>
<hr>
EOF;
}
}
else {
print<<<EOF
<div class="note">
<div class="text">
{$COM_LANG['no_comments_yet']}
</div>
</div>
EOF;
}
print<<<EOF
<div class="foot">
<form method=POST action='{$COM_CONF['script_url']}'>
<input type=hidden name="action" value="add">
<input type=hidden name="href" value="{$_SERVER['REQUEST_URI']}">
<table width="290" border="0" cellspacing="1" cellpadding="2" align="center">
<tr>
<td width="83" align="right"><font color="red">*</font>{$COM_LANG['Name']}:
</td>
<td width="196" align="left">
<input type=text name="disc_name" maxlength=40 size=30>
<input type=hidden name="r_disc_name" value="{$COM_LANG['r_disc_name']}">
</td>
</tr>
<tr>
<td width="83" align="right">{$COM_LANG['E-mail']}:</font></td>
<td width="196" align="left">
<input type="Text" name="disc_email" size="30" maxlength="70">
</td>
</tr>
<tr>
<td width="83"></td>
<td width="196" align="left">
<input type="checkbox" name="email_me"><font size=2><nobr>{$COM_LANG['Notify']}</nobr></font><br>
<input type="checkbox" name="dont_show_email" CHECKED><font size=2><nobr>{$COM_LANG['Dont_show_email']}</nobr></font><br>
</td>
</tr>
<tr>
<td valign="top" width="83" align="right">
<font color="red">*</font>{$COM_LANG['Text']}:
</td>
<td valign="top" width="196" align="left">
<textarea name="disc_body" cols="40" rows="8" wrap="VIRTUAL"></textarea>
<input type=hidden name="r_disc_body" value="{$COM_LANG['r_disc_text']}">
</td>
</tr>
<tr>
<td valign="top" width="83" align="right"> </td>
<td valign="top" width="196">
<div align="center">
<input type="submit" name="Submit" value="{$COM_LANG['Submit']}">
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
EOF;
?>