Forum Thread
  Posts  
DHTML Help. (Forums : Development Banter : DHTML Help.) Locked
Thread Options
methy
methy Is he black, is he not?
Mar 10 2006 Anchor

Hey,
I'm building a website for an unnancounced project (doesn't mean I'm giving up on other projects, jsut something on the side), and I realise that my PHP/MySQL knowledge is almost useless for the site I want to program.

I need to learn to use Javascript to get a div element from my CSS block and change its visibility property. When doing this, it also has to change every other div's visibility to hidden. I got some of this code off a tutorial and I was wondering what I needed to do.

function showDiv(act1) {
myReference = getRefToDiv(act1);
if( !myReference ) {
window.alert('Nothing works in this browser');
return; //don't go any further
}
if( myReference.style ) {
myReference.style.visibility = 'visible';
} else {
myReference.visibility = 'show';
}
}

//the div I want to change the visibility of is called "(#)act1", and it is all set up well and defaults to hidden visibility on page load. My link is <a href="#" onclick="showDiv('act1');">Link Text</a>.

However, this doesn't show the act1. I was wondering if anyone who actually knows Javascript and DHTML might have an idea of what to do.

Thanks.

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.