<html>
<head>
<script>
function $(id){
return document.getElementById(id);
}
function t(){
$('t_a').value=$('time').innerHTML;
}
</script>
</head>
<body>
<div style="width:800; margin:auto;">
<table>
<tr><td><a id="time" onmousedown="t()">测试</a></td><td><textarea rows="5" cols="60" id="t_a"></textarea></td></tr>
</table>
</div>
</body>
</html>
这个可以吗,
<head>
<script>
function $(id){
return document.getElementById(id);
}
function t(){
$('t_a').value=$('time').innerHTML;
}
</script>
</head>
<body>
<div style="width:800; margin:auto;">
<table>
<tr><td><a id="time" onmousedown="t()">测试</a></td><td><textarea rows="5" cols="60" id="t_a"></textarea></td></tr>
</table>
</div>
</body>
</html>
这个可以吗,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title> New Document </title>
<script type="text/javascript">
<!--
function s(o,c){
document.getElementById('area'+c).value = o.innerHTML;
}
-->
</script>
</head> <body>
<table>
<tr>
<td onclick="s(this,1)">文字1</td>
<td><textarea id="area1"></textarea></td>
</tr>
<tr>
<td onclick="s(this,2)">文字2</td>
<td><textarea id="area2"></textarea></td>
</tr>
<tr>
<td onclick="s(this,3)">文字3</td>
<td><textarea id="area3"></textarea></td>
</tr>
</table>
</body>
</html>
效果可以实现。这个只可以添加一次。光标定位呢怎么操作?就是你定位在哪个地方就可以在哪个地方添加。
function s(o,c){
document.getElementById('area'+c).value = o.innerHTML;
}
这里面的 o c是什么意思