I would like to know such a thing. When adding a new comment, you can insert " @ 123 " or "# 123" in the field, where 123 is the identifier of the user or article. But how to convert these tags into a link when the message is processed and even the link code becomes text. (PS Something like as like on Twitter or even like on HeshCode). PPS "HashCode", you have implemented such a function here, do not tell me how? I would appreciate it. What are the guesses? Thank.

    1 answer 1

    As an option:

    1) Replace all the substrings of the form / @ (d +) / with a certain structure that catches the mouse, for example:

    <a href = "comment.php?id=ID" onmouseover = "showComment(this, ID);" onmouseout = "hideComment(this);" >ΠšΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΉ β„–ID</a> 

    2) Write the function to show / hide the comment:

     function showComment( el, id ){ //AJAX запрос Π½Π° ΠΏΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ содСрТимого коммСнтария ID = id //Π”ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ элСмСнта с ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠ΅ΠΌ Π² DOM Π³Π΄Π΅-Ρ‚ΠΎ рядом с el //ΠžΡΡ‚Π°Π²Π»ΡΠ΅ΠΌ ссылку Π² el Π½Π° созданный } function hideComment( el ){ //УдаляСм элСмСнт с ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠ΅ΠΌ ΠΈΠ· DOM } 
    • Thank! Exactly what is needed. - Elected