Javascript:获取单元格的列ID [英] Javascript: Get cell's column id

查看:119
本文介绍了Javascript:获取单元格的列ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

我想完成下面的伪代码

 <&素文字GT; 
var intCol = document.getElementById('x')。column
< / scipt>

有没有办法做到这一点?

解决方案

你为什么不能使用 cellIndex



在此page:

  $('。postcell')[0] .cellIndex 
> 1
$('。votecell')[0] .cellIndex
> 0

我知道人们讨厌W3School,但他们提供了一个很好的基本数据集:
< A HREF = http://www.w3schools.com/jsref/prop_tabledata_cellindex.asp 相对= nofollow> http://www.w3schools.com/jsref/prop_tabledata_cellindex.asp


For example:

I want to accomplish what the following psuedo code does

<scipt>
var intCol = document.getElementById('x').column
</scipt>

Is there a way to do this?

解决方案

Why can't you use cellIndex?

On this page:

$('.postcell')[0].cellIndex
> 1
$('.votecell')[0].cellIndex
> 0

I know people hate W3Schools, but they do provide a good basic dataset: http://www.w3schools.com/jsref/prop_tabledata_cellindex.asp

这篇关于Javascript:获取单元格的列ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆