Important Notice for Existing Members: the system is recently updated, and login system is also upgraded. You will need to reset your password to log in again. Please use the FORGOT PASSWORD button below to reset, and after all the procedures, you will be able to log back in. Email us for any issues

Member? Come on in!

Forgot password?

Not angel? Sign up now!

Java help?
Started by crays 2-6-09 .

Hey guys, i couldn't find any code that allows me to hide/unhide a div with only 1 button. It always come with 2 button. Any help? So far i thought of this, but its not working.

function hideDiv() {
if (document.getElementById('p1').style.visibility == "hidden") {
document.getElementById('p1').style.visibility = 'visible';
else {
if (document.getElementById('p1').style.visibility == "visible") {
document.getElementById('p1').style.visibility = 'hidden';

//input type="button" onclick="hideDiv()" value="Hide text" />

Post edited 2-6-09

Night Angel 2-6-09 2009-06-02 12:39:34

I don't know about JAVA but I know Javascript I think it should be like this:

function hideDiv() {
if (document.getElementById('p1').style.display=='none') {
document.getElementById('p1').style.display = '';
} else {
document.getElementById('p1').style.display = 'none';


crays 2-6-09 2009-06-02 12:55:02

Thanks, sorry i meant javascript. Wth lol. Tried it, thanks, worked well
Didn't know there's a DOM called display ...

Night Angel 2-6-09 2009-06-02 15:05:54

It is the same as all the styles in CSS like these:


Just the same as you can use in CSS

crays 2-6-09 2009-06-02 15:43:24

in CSS too ?! I didn't know that O_O . Woah, learned much !

manifest3r 2-6-09 2009-06-02 16:38:57

That's relieves me somewhat because im gonna be learning javascript in the fall (hopefully)

crays . 3-6-09
Oh cool, good luck man . Its really fun to play with them if you understand. Else... lol.

Night Angel 3-6-09 2009-06-03 01:34:19

Yupe all good

crays, so you can use the same script to call or change other properties of an element, like = 19px for example

crays 3-6-09 2009-06-03 03:42:22

Yeah, noticed it now . Am not really good at javascript just like a fun time thing to do.

You must log in to comment on threads and posts.

Return to forum Scroll to top Email this post to someone