I have many text area in one page I get them by a link called “comment” so her is the idea I made a code in php that includes a form when the user clicks on “comment” this is an Ex.
if(isset($_GET[‘comments’])) { $comments = $_GET[‘comments’];
}
if (!isset($_GET[‘comments’])) {
$comments = “”;
}
if ($comments == “ok”) {echo "<tr><td colspan='6' align='center'>"; echo "<span class='rePost'>Re : </span><spanclass=’blogerName’>$blog->ByName”;
include “postComments.php”; echo
“”;} ?>
now when the user clicks on comment it just includes the comment text area
but here there is more then one threads on the same page or I can say more then one post on the same page so when the user clicks on “comment” on post one all the other posts get the text area below it.
what I need here is when the user clicks comment on post “1” the text area appear below post “1” and not 2 or 3 or any other one on this page.
I hope I got you to the point that I want.
I think it can be do by java or if anybody have a other idea please post it to me.
What you want is best implemented by means of JavaScript as I think you meant when you said “Java”. As the commenters have pointed out the two are not related.
Basically there is two ways you could approach this.
You could:
a) put out all of your TextAreas along with the page at all times but give them a css class with
display:none. Each of the TextAreas or its surrounding container that you set to be invisible this way needs to have a unique id, too.Then you can use a javascript function to assign another class that does not have the
display:noneproperty to any single id.b) put out empty elements where the text areas are supposed to go later but also with a unique id. You’d then load HTML when it’s needed by means of Javascript (AJAX). This is only a good choice if there are many possible elements and putting all of them out at all times blows up your page too much.
Does the site use any JS framework like jQuery? Anyway this might get you started in implementing option a above:
This does rely on the ids of the elemets we are showing/hiding to be
c0throughcNwithNbeing the count of elements to show/hide minus one…