What most people do, when they need to flip-flop between two states (e.g, in your case, presumably between hidden and visible) is to look for the NON-DEFAULT state.
So if the CSS default is, as in your case,
hidden, then in the JS code you would do something like this:
Code:
var para = document.getElementById("test");
para.stye.visibility = ( para.stye.visibility == "visible" ? "hidden" : "visible" );
This works because the default is seen as just "" so the first flip-flop changes it to "visible" and from then on the value has been set by JS code and so is available.
Clearly, if you don't know ahead of time which is the default, then this can't work.