看看吧:你写的代码存在执行顺序的问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>无标题文档 </title> </head> <body> 
<a href="#" id="link1">hello,world </a> 
<form name="Form1"> 
<textarea name="Text1" cols="60" rows="20"> this is a test for the stringout! </textarea> 
</form> <script type="text/javascript"> 
var i = 1; 
function DoIt() 

message="for the"+i+"times,hello,world \n"; 
document.Form1.Text1.value+=message; 
i++; 

var stringout = document.getElementById('link1'); 
stringout.onclick = DoIt; </script> 
</body> 
</html>