如
<input type="button" onclick="getTable()">
...
...
<table>
...
</table>
<script>
function getTable()
{
..这里取得对像后面的第一个table谢谢
}
</script>
<input type="button" onclick="getTable()">
...
...
<table>
...
</table>
<script>
function getTable()
{
..这里取得对像后面的第一个table谢谢
}
</script>
解决方案 »
- 关于秒表的问题
- 为什么我用Ext2.1.0 版本 创建普通菜单,菜单上总有个......
- 请教高手,这个特效应该怎么做?
- 杭州电信却持网站怎么解决?我的网站www.hoterp.com打不开,自动转到了114上的了
- 把extjs4.2 desktop 窗口最大化动画效果移植到extjs4.1 中
- 取当前日期的前一天
- jQuery validate 怎么验证一串数字是手机号或者是座机号?
- 急!!!!!表单提交后判断值是否为空的问题!
- 当将复制的文本粘贴到textarea中后原来的tab键的4个空格变成了8个,怎样保持tab键为4个空格?
- 怎样能使javascript中调用高级控件TDC中的数据源中的数据显示在文本框中呢,急于解决???
- 请教关于淘宝搜索 inf¸js 的代码的分析
- .net 想要给一个框架页面(frameset)加上一个页面加载效果,如何实现啊?
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
function getTable(obj){
alert($(obj).next("table").attr("id"));
}
</script>
</head>
<body><input type="button" onclick="getTable(this)">
...
...
<table id=aa>
...
</table>
</body>
</html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
function getTable(obj){
var i=$("input,table").index(obj);
alert($("input,table").get(i+1).id);
}
</script>
</head>
<body><input type="text" id=s1 > <input type="button" id=s2 onclick="getTable(this)">
...
...
<table id=aa>
...
</table>
<div id=bb>ddd</div>
</body>
</html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
function getTable(obj){
var i=$("input[onclick='getTable(this)'],table").index(obj);
alert($("input[onclick='getTable(this)'],table").get(i+1).id);
}
</script>
</head>
<body>
<input type="text" > <input type="button" onclick="getTable(this)">
<input type="text" >
...
...
<table id=aa>
...
</table>
<div id=bb>ddd</div>
</body>
</html>