<table>
<tr id=t1 onclick="alert(document.all.t1.id)"><td>...</td></tr>
</table>
<tr id=t1 onclick="alert(document.all.t1.id)"><td>...</td></tr>
</table>
解决方案 »
- No result defined for action ** and result input
- 如何动态的JSP页面生成静态的HTML页面
- SSH与JSP的书推荐几本([入门与提高]),谢谢!!!!
- flex+ssh集合的时候,配了xml catalog出现的问题.
- 如何把OPTION的VALUE传到JSP里啊?
- 大家有没有碰到过这样的关于javamail的问题!
- 怎么把SQLSERVER里IMAGE字段取出来然后在页面把该字段转换并显示图片啊??
- 关于lucene中多条件搜索文件的问题,各位帮忙啊
- 版主上任,推荐几个jsp学习的网站,请进
- spring mvc html多文件上传是如何实现的transferTo()每次上传文件后关闭吗?
- 没接触过JSP,问一个Frame的问题,老大们请帮忙,急
- 数据库查询报错,大家帮我看看!
分别为id="1",,,,,,id="1000000000000"
然后用上面的说发就可以了
function selecteRow(rowi){
var url = "showinfo.jsp?rowID=" + rowi;
document.location.href = url; }
</script>
<%
if(request.getParameter("rowID")!=null){
...
...
...
ResultSet rs_info = Statement.executeQuery("select id,name,age from userinfo where id=" + request.getParameter("rowID"));
}else{
ResultSet rs_info = Statement.executeQuery("select id,name,age from userinfo");
}
%>
<table border='1' width='100%'>
<%
while(rs_info.next())
{
%>
<tr onclick='javascript:selecteRow(<%=rs_info.getString(id)%>)'>
<td width='30%'><%=rs_info.getString("id")%></td>
<td width='30%'><%=rs_info.getString("name")%></td>
<td width='40%'><%=rs_info.getString("age")%></td>
</tr>
<%
}
%>
</table>
另一种方法是通过TR 的属性sectionRowIndex得到当前行
给你一个微软的htc模型1、建一个CSS:
.clsQueryDetail {
font-size: 12px; color: #333366; BEHAVIOR: url(../css_js/DynamicQuery.htc);
}2、在你的TD上,(注意是TD,上张帖子我打错了)都加入这个CSS
<td width=20% valign=top class='clsQueryDetail'>
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="fnGrab()" />
<SCRIPT LANGUAGE="JScript">
var now_tr=0;
function fnGrab(){
var oEl = event.srcElement;
if (oEl.className == "clsQueryDetail"){
window.document.attachEvent( "onmousedown" , fnDynamicQuery );
window.document.attachEvent( "onmouseup" , fnRelease );
}
}
function fnRelease(){
var oEl=event.srcElement;
window.document.detachEvent( "onmousedown" , fnDynamicQuery );
window.document.detachEvent( "onmouseup" , fnRelease );
}
function fnDynamicQuery(){
var oEl=event.srcElement;
now_tr=oEl.parentElement.sectionRowIndex;
alert("当前行是==========="+now_tr);
/**
*执行你的操作
**/
fnRelease();
}
</PUBLIC:COMPONENT>