当前位置: 技术问答>java相关
紧急求救:光标放在浏览器里表格里,怎得到光标所在的td 是table 的第几行?第几列?
来源: 互联网 发布时间:2015-02-15
本文导语: | use Java or Javascript? if you use Internet Explorer and Javascript, try this (see the status bar for row/column numbers): function document.onmousemove() { if (event.srcElement.tagName == "TD") { window.status = "row:" + event.srcElement.parent...
|
use Java or Javascript?
if you use Internet Explorer and Javascript, try this (see the status bar for row/column numbers):
function document.onmousemove()
{
if (event.srcElement.tagName == "TD")
{
window.status = "row:" + event.srcElement.parentElement.rowIndex + ";col:" + event.srcElement.cellIndex;
}
else
window.status = "Move the mouse cursor back to the table to see the row/column numbers";
}
0-00-10-2
1-01-11-2
2-02-12-2
3-03-13-2
if you use Internet Explorer and Javascript, try this (see the status bar for row/column numbers):
function document.onmousemove()
{
if (event.srcElement.tagName == "TD")
{
window.status = "row:" + event.srcElement.parentElement.rowIndex + ";col:" + event.srcElement.cellIndex;
}
else
window.status = "Move the mouse cursor back to the table to see the row/column numbers";
}
0-00-10-2
1-01-11-2
2-02-12-2
3-03-13-2
|
JTable.getSelectedRows()和JTable.getSelectedColumns()
都分别返回一个整型数组,数组中存放了,选中的行或列的序号
都分别返回一个整型数组,数组中存放了,选中的行或列的序号