473,769 Members | 5,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.displ ay = "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:repeate r>). Is it
possible to give the table rows dynamic ids as I loop through the
repeater?

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


OM wrote:

To make the collapse / expand functionality I want to use JavaScript
to display / hide table rows using row.style.displ ay = "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:repeate r>). 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
2168
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. Build the thing in the .HTMLbody of CDO while looping 3. Another elegant method.... The customer email (TO: john@catco.com) would look something like this:
1
4855
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 onclik=Alert("EditFieldValue2.value"); Please reply me as soon as possible.
3
1909
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 been looking around online for solutions, but the fixes I have seen don't seem to work. I assume I am misunderstanding something... I was using element.setAttribute but have changed my code to avoid that. Here is an example. IE6 displays the link...
0
2103
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, but I can't figure out how to perform this. I have a template that has the headers with autofilter turned on, but when I click on the cell, no formula is displayed. sb.Append("<tr><td align=""center"">")
0
1035
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: http://www.amazon.com/Dynamic-HTML-Definitive-Danny-Goodman/dp/0596527403/sr=8-1/qid=1165318775/ref=sr_1_1/104-8827749-5771100?ie=UTF8&s=books I really can't recommend it highly enough - it is, without doubt, the dynamic HTML bible.
0
1069
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 application forms by inserting text box's, text areas, drop down's, checkbox's and radio buttons dynamically. With this I create the form and allow them to have valdiation set for the controls too so that they can specifiy if it's a required field or...
0
1407
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 but it kick me out from the site if I select the last indext agin in the dropdown list. It even works fine for other indexes. And this problem is only on IE-7. Sample code: strHTML += "<tr class='Display' nowrap id='row_scope" + i + "'...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.