Lyrics - Discount Furniture Values - Sport Betting Bonuses - Skype - Deaf Topics

PDA

View Full Version : Java Script for FAQ section E.g. provided


indiarahul
Apr 15th 2009, 3:24 am
Hi

I would like to if anyone of you an help me find a javascript for my websites FAQ section I want to use the some what the same script as used by http://www.megaupload.com/?c=faq

Looking forward for your help

fex
Apr 15th 2009, 9:11 am
Look in it's source code, it's right there :confused:

Ristaki
Apr 19th 2009, 3:45 pm
It's easy :)

<script>
var image = { "on" : "images/on.png", "off" : "images/off.png" }

function toggleContent(divId, imageId){

if(document.getElementById(div).style.display == 'none'){
document.getElementById(div).style.display = 'block';
document.getElementById(imageId).src = image['off'];
}else{
document.getElementById(div).style.display = 'none';
document.getElementById(imageId).src = image['on'];
}

}

</script>

The usage is this:

<a href='#' onClick='toggleContent("info1", "infoImage1")'><img src='images/on.png'> Show Info</a>
<div id="info1">Some Info</div>

:)