Actually a subject how to implement citing of a certain answer?

as I understand it, you need to pull out the line of one of the answers / comments and insert it into the textarea, the question of the implementation of this miracle. Google 2 pages did not help (

I think about logic, but I don’t understand how to implement it. If with tags where you made a mistake, I suppose that you can implement it in all 3 ways.

UPD

<table width="100%" border=0> <tr> <td width="5"><img src="/img/spacer.gif" width="5" height="58" border="0"></td> <td background="/img/spacer.gif" class="ctitle" valign="top" colspan="2"> #<?echo $n ?> написал: <? echo $res['autor']; ?> (<? echo $date; ?>)</td> <td width="5"><img src="/img/spacer.gif" width="5" height="58" border="0"></td> </tr> <tr> <td background="/img/spacer.gif"><img src="/img/spacer.gif" width="5" border="0"></td> <td valign="top" colspan="2"> <table width="100%"> <tr> <td width="140" valign="top" border=1 style="color: #717171;font-size: 11px;font-family: tahoma;"><img src="" border="0" /><br /> <img width="100" height="20" src="<?echo $usergroupico;?>" /><br /><br />Группа: <? echo $usergroup; ?><br />Регистрация: </td> <td class="your_comment_container" valign="top"><? echo $res['message']; ?><br /><br /> --------------------<br /><div style="color: #717171;font-size: 11px;font-family: tahoma;"><? echo $signature; ?></div> </td> </tr> </table> </td> <td background="/img/spacer.gif"><img src="/img/spacer.gif" width="5" border="0"></td> </tr> <tr> <td><img src="/img/spacer.gif" width="5" height="32" border="0"></td> <td background="/img/spacer.gif" style="color: #717171;font-size: 11px;font-family: tahoma;" align="left"> ICQ: </td> <td background="/img/spacer.gif" style="color: #717171;font-size: 11px;font-family: tahoma;" align="right"> <a href="" class="quote_btn">цитировать</a> <a href="">изменить</a> <a href="">удалить</a></td> <td><img src="/img/spacer.gif" width="5" height="32" border="0"></td> </tr> </table> <?} ?> <h2>Добавить ответ</h2> <? if(!$_POST['newreply']) { echo ' <div class="form"> <form method="post" class="niceform"> <fieldset> <dl> <dt><label for="comments">Ответ:</label></dt> <dd> <textarea name="newreply" id="my_comment_field" rows="15" cols="43"></textarea></dd> </dl> <dl class="submit"> <input type="submit" name="submit" id="submit" value="Создать" /> </dl> </fieldset> </form> </div> '; } else { if (!get_magic_quotes_gpc()) { $newreply = addslashes($_POST['newreply']); } else { $newreply = ($_POST['newreply']); } @$link = mysql_connect("$hostr", "$userr", "$passwordr"); if (!$link) { die('Не могу соедениться: ' . mysql_error()); } mysql_select_db($dbr); mysql_query("SET NAMES 'utf8'"); mysql_query ("set character_set_client='utf8'"); mysql_query ("set character_set_results='utf8'"); mysql_query ("set collation_connection='utf8_unicode_ci'"); $data = date("Ymd"); $q = "insert into `proj_detail` (catId, autor, access, message, date) values ('$_GET[id]','$_SESSION[login]','$_SESSION[access]','$newreply','$data')"; $r = mysql_query($q); if (!$r) { echo "MySQL error: " . mysql_error()."!"; } else { echo "Сообщение добавлено";} echo '<br><a href="index.php?module=projdetail&id='.$_GET['id'].'">Посмотерь категорию</a>'; } 

Responsible for displaying messages and adding code

    2 answers 2

    An example using jQuery:

     <div> <div class="your_comment_container"> Тут текст комментария который будет цитироватся </div> <div class="quote_btn">Коментировать</div> </div> <textarea id="my_comment_field"> </textarea> <script> $(document).ready(function(){ $(".quote_btn").click(function(){ var text_to_quote = $(this).parent().children("div.your_comment_container").html(); $("#my_comment_field").val(text_to_quote) }); }); </script> 
    • I certainly can not understand something, but it does not work ( - DemoriaN
    • I apologize. wrote $ (this) .parrent () but $ (this) .parent () is needed - Daniel Vendolin
    • and which jquery library should be used, otherwise there are a lot of them now) - DemoriaN
    • Take the latest build. 1.6 and higher. By library, I meant jQuery itself, not companion plugins. - Daniel Vendolin
    • downloaded, loaded, if you do divas, at least divine it, if you do on a href, then there is no result either. - DemoriaN

    Actually, you need to catch the selected text and everything, right? If so, then dig the jquery docks, I am sure that there must be something there!
    And if you want to simply add the contents of the comments to the form by clicking on the button next to the comments - then this is easier than ever, selectors will help you! If you do not understand - I will give a schematic code.