<Li id = ""> <span> *** </span> comment <span> fresh fruit </span> <a href = "# message_area" onclick = "fillInMessageArea (this ); "> reply </a> </li>
<Li id = ""> <span> pizicai </span> comment <span> you </span> <a href = "# message_area" onclick = "fillInMessageArea (this ); "> reply </a> </li>
<Form action = "">
<Textarea onkeyup = "rewrite ();" rows = "4" cols = "30" id = "message_area" name = "message_area"> </textarea>
<P> </p>
<Input type = "submit"/>
<Input class = "not_write" id = "input_rewrite" type = "button" onclick = "clearAll ();"/>
</Form>
</Div>
<Script type = "text/javascript">
Function fillInMessageArea (othis ){
Var text = othis. parentNode. childNodes [0]. firstChild. nodeValue;
Text = 'reply '+ text;
Text + = ':';
Var me_area = $ ('# message_area ');
Me_area.val ("");
Me_area.val (text );
SetFocus ();
}
Function clearAll (){
Var me_area = $ ('# message_area ');
Var input = document. getElementById ('input _ rewrite ');
If (me_area.attr ('class') = 'not _ write') return false;
Var text = me_area.val ();
Text = text. replace (/(^ \ S + (:) + ?) (\ S *. + \ s *) +/, "$1 ");
If (! Text. match (/(.*?) :/))
Me_area.val ("");
Else
Me_area.val (text );
SetFocus ();
Hide_rewrite (input );
}
Function rewrite (){
Var me_area = $ ('# message_area ');
Var text = me_area.val ();
Var input = document. getElementById ('input _ rewrite ');
If (text. match (/^ \ S + (:) +? (\ S *. + \ s *) +/) | (! Text. match (/(.*?) :/)))
Show_rewrite (input );
// Input. value = "not null ";
Else
Hide_rewrite (input );
If (text = '')
Hide_rewrite (input );
// Input. value = "null ";
// Alert ('null ');
}
Function show_rewrite (input ){
Input. className = "can_rewrite ";
}
Function hide_rewrite (input ){
Input. className = "not_write ";
}
Function setFocus (){
Esrc = document. getElementById ('message _ Region ');
// Esrc. focus ();
Var rtextRange = "";
If (esrc. createTextRange ){
RtextRange = esrc. createTextRange ();
RtextRange. moveStart ('character ', esrc. value. length );
RtextRange. collapse (true );
RtextRange. select ();
}
}