473,396 Members | 1,886 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,396 software developers and data experts.

adding class automation

i need to add class to dynamically created span tags so that i can highlight it for some duration of time and then i need to remove it from this span and add class to other span tag.. In short u can say add class and remove class should continues based on time on each of the span tags..

example:
Expand|Select|Wrap|Line Numbers
  1. <span>some text1</span><span>some text2</span><span>some text3</span>
like this and i want text1 to be highlighted first and after few seconds second one should highlighted and so on..

Thanks in Advance
Anand kumar Singh
Jun 14 '13 #1
2 1268
Dormilich
8,658 Expert Mod 8TB
what have you tried?
Jun 14 '13 #2
gits
5,390 Expert Mod 4TB
a simple start would be like this:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <style type="text/css">
  3.         .hl {
  4.             color: red;
  5.         }
  6.     </style>
  7.     <script type="text/javascript">
  8.         function highlightNodes() {
  9.             var nodeBase = document.getElementsByTagName('SPAN');
  10.             var curNode = -1;
  11.  
  12.             for (var i = 0, n; n = nodeBase[i]; i++) {
  13.                 if (n.className == 'hl') {
  14.                     curNode = i;
  15.                     n.className = '';
  16.  
  17.                     if (curNode == nodeBase.length - 1) {
  18.                         curNode = -1;
  19.                     }
  20.                 }
  21.             }
  22.  
  23.             nodeBase[curNode + 1].className = 'hl';
  24.         }
  25.     </script>
  26.     <body onload="window.setInterval(highlightNodes, 1000);">
  27.         <span>some text1</span>
  28.         <span>some text2</span>
  29.         <span>some text3</span>
  30.     </body>
  31. </html>
  32.  
check it and try to understand it and adapt it to what u need. then come back with more specific questions.
Jun 14 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Ares Lagae | last post by:
When adopting the coding style of the standard C++ library, you often run into naming problems because class names are lower case, and member functions do not have get/set prefixes. For example:...
7
by: shahehe | last post by:
The following code seems fine to me but when I tried to compile it using g++ test.C, I got lots of errors, why? #include <iostream> static const int MAX_STACK = 100; class Stack
0
by: comzy | last post by:
Hi all, I just need to add a class file in the updateable pre compiled project in vs.net 2005. can anyone tell me how can i do this because i couldnt find the APP_Code folder in the pre compiled...
4
by: Jonathan Wood | last post by:
I'm building a Web application but this question should be common to all C# applications. When I use a class, and I want to add event handlers or override base class methods, how do I know the...
49
by: Ben Voigt [C++ MVP] | last post by:
I'm trying to construct a compelling example of the need for a language feature, with full support for generics, to introduce all static members and nested classes of another type into the current...
2
by: lucius | last post by:
I am working with a site that uses inline code in .aspx files and C# code in the header area. I would like to add some HTTPModules and HttpHandlers but am not sure where to put the .cs files and...
1
by: jholg | last post by:
Hi, regarding automatically adding functionality to a class (basically taken from the cookbook recipee) and Python's lexical nested scoping I have a question wrt this code: #-----------------...
5
by: Neal Becker | last post by:
After spending the morning debugging where I had misspelled the name of an attribute (thus adding a new attr instead of updating an existing one), I would like a way to decorate a class so that...
2
by: Fresno Bob | last post by:
Hi I am used to using the App_Code folder to put my DAL and BLL classes. However I want to move toward using separate dll's so I can start doing things like Unit Tests and using Sandcastle for...
36
by: puzzlecracker | last post by:
Would someone explain why this declaration is illegal: class Sample<T> where T : Stream, class
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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.