tags:

views:

8

answers:

0

I am trying to change the background and foreground color when a entry in the html is clicked.

The current working javascript is like this document.getElementById(pos).className='style2'; where 'style2' contains the definition of the background color, foreground color and the a href color.

Here is a sample entry that is rendered via HTML.

abc

But I also need to do this from the java side by executing a set of javascript on the WebBrowser widget on the fly.

I got this set of code working.

         final String e1 = new String("document.getElementById("+newPos+").style.backgroundColor='#111111';" + "\n");
           final String e2 = new String("document.getElementById("+newPos+").style.color='#fff';" + "\n");
            final String e3 = new String("document.getElementById("+newPos+").style.border='#222222';" + "\n");

My question is how could I define the a href link's color to be white for the associated element that returned from document.getElementById?

Thanks a lot.