473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Is it possible to make dynamic ids for html-tags

OM

I am trying to present tree-structure information using a html table
and JavaScript. Each tree node is displayed in the first column in a
table row. The tree node can also have additional information in
other table columns.

To make the collapse / expand functionality I want to use JavaScript
to display / hide table rows using row.style.display = "inline" /
"none".

To get references to the table rows they all need unique id's. I want
the root node to have id="1", the nodes on the second level should
have id="1.1", "1.2", "1.3", the nodes on the third level should have
id="1.1.1", "1.1.2", "1.1.3" etc.

id=1
id=1.1
id=1.1.1
id=1.1.2
id=1.2
id=1.2.1

The html code is made using a repeater (<netui:repeater>). Is it
possible to give the table rows dynamic ids as I loop through the
repeater?

-------
OM
Jul 23 '05 #1
1 3337


OM wrote:

To make the collapse / expand functionality I want to use JavaScript
to display / hide table rows using row.style.display = "inline" /
"none".
Be aware that CSS 2 requires
table-row
and not
inline
for table row elements thus if you want to script table rows in Mozilla
for instance then you shouldn't use inline but use table-row as the
value for the CSS display property.
To get references to the table rows they all need unique id's. I want
the root node to have id="1", the nodes on the second level should
have id="1.1", "1.2", "1.3", the nodes on the third level should have
id="1.1.1", "1.1.2", "1.1.3" etc.

id=1
id=1.1
id=1.1.1
id=1.1.2
id=1.2
id=1.2.1

The html code is made using a repeater (<netui:repeater>). Is it
possible to give the table rows dynamic ids as I loop through the
repeater?


Yes, why not, but there are rules for id attribute values, see here
<http://www.w3.org/TR/html4/struct/global.html#h-7.5.2>
<http://www.w3.org/TR/html4/types.html#type-name>
so you need to start an id attribute value with a letter a-zA-Z.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jason | last post by:
What is the best way to build a dynamic html body message if one is looping through a customer table (=/=500 customers) and corresponding inventory table: 1. FSO html template with paramters 2....
1
by: SAN CAZIANO | last post by:
I have create a dynamic html table by adding some rows where I have to put some value in an input field and now how can I get all value of all row ??? I try this but it doesn' work button...
3
by: Aaron Gervais | last post by:
I am brand-new to javascript, but after reading some tutorials online I was able to make a dynamic HTML photo gallery in javascript. It works fine in all browsers except IE6 (big surprise). I've...
0
by: Amy B | last post by:
Hi, I am using the code below to dynamically build an html table and write it to excel an excel spreadsheet. This code works great except that I need the headers use AutoFilter on the headers,...
0
by: Mark Rae | last post by:
Hi all, Seems we've had a bit of a glut of posts relating to dynamic HTML lately (checkboxes in grids etc), so I thought I'd give a plug to this: ...
0
by: robert112 | last post by:
Hi all, I have a WYSIWIG editor (fckeditor) and allow the users to create dynamic html which I save and display later on in the application. The aim is to have the user be able to create...
0
by: gman united | last post by:
We have a classic asp site. The last index value from the dropdown list get populated first. selecting each dropdown value creates dynamic html table. It works fine when it loads for the first time...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.