View Single Post
  #1 (permalink)  
Old September 8th, 2008, 09:16 AM
peirix peirix is offline
Authorized User
Join Date: Sep 2008
Location: Oslo, , Norway.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to peirix
Default counting columns

Hi. I'm trying to figure out how to count number of <col />-tags inside the document. The reason I need to count them, is that the pages will be generated, and there is no way of knowing how many columns there will be, or what their id-tag will be.

var testObj = document.getElementById("colGroup").childNodes;
returned a very high number, so I guess that's no good.

I will also need to find out how to access the id-tag

sample code:

<colgroup id="colGroup">
   <col span="2" id="date" />

   <col id="win32" />
   <col id="win32_md_debug" />
   <col id="win32_md_release" />
   <col id="win32_mt_debug" />
   <col id="win32_mt_release" />

   <col id="ubuntu32" />
   <col id="ubuntu32_release" />

   <col id="solaris32" />
   <col id="solaris32_release" />

   <col id="osx32" />
   <col id="osx32_release" />

   <col id="centos64" />
   <col id="centos64_release" />

   <col id="gentoo64" />
   <col id="gentoo64_release" />