You may be able to change the page DOM through JavaScript, but once an applet is initialized, any change of the page won't be reflected in the applet. To influence a running applet via JavaScript, you need to access its public fields and methods via LiveConnect, and react accordingly in your applet code. The
Applets FAQ has some links about LiveConnect.