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