Changing style (visibility) with Javascript

admin

Administrator
Staff member
Hi,

I'm trying to write a script that allows the viewer to click or hover over a link (a question) that will change the visibility of the following paragraph (the answer) from hidden to visible.

I may have more than one question on each page so I was hoping to pass the ID of the answer to the function (if this would work), so I could view only one answer at a time.

My existing HTML is along the lines of:

<p><a HREF=http://www.webdeveloper.com/forum/archive/index.php/"#" CLASS="nowrap">here is a question<img alt="question" src="graphics/why.jpg" CLASS="questionimage"</a></p>
<p ID="answer1" CLASS="invisible"><b>Answer:</b> the answer is here!</p>

I'm not sure whether it's easier to use CLASS="visible" and CLASS="invisible" rather than specifying the style.

Thanks in advance,

Fraser
 
Back
Top