<table width="50%" border="1" cellspacing="0" cellpadding="3" onMouseOver="event.srcElement.bgColor='#FF0000'" onMouseOut="event.srcElement.bgColor=''" onClick="txt.value=event.srcElement.innerText">
<tr>
<td>1111111</td>
<td>2222222</td>
</tr>
<tr>
<td>3333333</td>
<td>4444444</td>
</tr>
</table><p>
<input type="text" name="txt" value="">这个例子是onClick传给本页文本框的,如果要传给父页面的文本框改为
onClick="opener.txt.value=event.srcElement.innerText"
<tr>
<td>1111111</td>
<td>2222222</td>
</tr>
<tr>
<td>3333333</td>
<td>4444444</td>
</tr>
</table><p>
<input type="text" name="txt" value="">这个例子是onClick传给本页文本框的,如果要传给父页面的文本框改为
onClick="opener.txt.value=event.srcElement.innerText"
<tr align=left bgcolor="eeeeee" onMouseOver=mouseOver(this,'999999'); onMouseOut=mouseOut(this,'336699');>
<td>d</td>
</tr>
</table><script language=javascript>
function mouseOver(obj,color){
obj.bgColor=color;
}function mouseOut(obj,color){
obj.bgColor=color;
}
</script>
function city(v)
{
var city=new Array();
var i;
city=selectArr(v);
i=city.length;
var str="";
str+="<table WIDTH=\"100%\" border=\"1\" CELLSPACING=\"0\" bordercolor=\"#E7E7E7\" cellpadding=\"0\"";
str+="onMouseOver=\"event.srcElement.bgColor='#66CCFF'\" ";
str+="onMouseOut=\"event.srcElement.bgColor=''\"";
str+="onClick=\"opener.document.all[\"txtcity\"].value=event.srcElement.innerText\">";
str+="<th ><center>城市名</center></th>";
document.writeln(str )
for(j=0;j<i;j++)
{
document.writeln("<tr style='cursor:hand'><td align=left ><font size=2 >"+city[j]+"</font></td></tr>");
}
document.writeln("</table>"); }
鼠标移动时记录的颜色可改变,但是onclick事件没有任何反应,不知为何,请多指点!