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

Easy algorithm, please help

abs
Here's my page containing problematic alghoritm which seems to be easy but I
have some problems with it: http://tinyurl.com/a2v58
The trouble is that when I click on element which has yellow background, it
turns red and it's ok. But after that I click another element and previous
element becomes white insted of be yellow again. Could anybody help me ? I
marked that part in the code.
And sorry, this code probably works in IE only, for other browsers I've got
another version prepared.

Best regards,
ABS
Jul 23 '05 #1
2 1143
VK
> Easy algorithm, please help

UL's again... It would be really helpful to know what is your final
aim, or at least what complete interface behaviour are you trying to
reach.

Jul 23 '05 #2
abs <no****@wp.pl> wrote in message
news:d7**********@inews.gazeta.pl...
Here's my page containing problematic alghoritm which seems to be easy but I have some problems with it: http://tinyurl.com/a2v58
The trouble is that when I click on element which has yellow background, it turns red and it's ok. But after that I click another element and previous element becomes white insted of be yellow again. Could anybody help me ? I marked that part in the code.
And sorry, this code probably works in IE only, for other browsers I've got another version prepared.

Best regards,
ABS

/* the main, problematic alghoritm part is here */

prevColor = colorBuf

clicked = evt.srcElement // element that has been clicked

colorBuf = clicked.style.backgroundColor

clicked.style.backgroundColor = 'red'

clickedPrev.style.backgroundColor = prevColor

clickedPrev = clicked

colorBuf = prevColor
^^^^^^^^^^^^^^^^^----This line destroys the value of the
pre-click background of the current element.
Just remove it.

/* end of problematic part */

--
Stephen Chalmers http://makeashorterlink.com/?H3E82245A

547265617375726520627572696564206174204F2E532E2072 65663A20545132343739
3134

Jul 23 '05 #3

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

Similar topics

17
by: savesdeday | last post by:
In my beginnning computer science class we were asked to translate a simple interest problem. We are expected to write an algorithm that gets values for the starting account balance B, annual...
5
by: junky_fellow | last post by:
How do we calculate the complexity of an algorithm? Am i right if i say the complexity of an algorithm is the number of comparisons done in that algorithm? thanx in advance .......
2
by: ben | last post by:
hello, i'm following an algorithm book and am stuck on an early excersise in it, not because of the c programming side of it or even the algorithm side of it, i don't think, but because of maths....
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
4
by: Kinsley Turner | last post by:
Hey-ho, I'm getting a bit out of my depth porting the 'tiny encryption algorithm' from C to python. Ref: http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
1
by: kester83 | last post by:
hi, i am actually doing a project in C++ that is able to carry out voice morphing properties. however, i am kind of stuck with the peak detection which is essential for carrying on with the...
0
by: Victor Bazarov | last post by:
Somebody wrote: We talk C++ language here. For general programming help (like with an algorithm or concepts) please post to 'comp.programming'. If you have trouble expressing your _existing_...
2
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. basically i need to read in a text file... shown below H H,E,L E,B,F B,A,C A,null,null c,null,D
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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.