Wednesday, April 4, 2007

Javascript for show-hide Div

Shown below is the function for showing and hiding two div containers

The function showHideDiv has two variables for passing the values for which div has to show and which div has to hide.

function showHideDiv(divToShow, divToHide)

{
document.getElementById(divToShow).style.display = "block";
document.getElementById(divToHide).style.display = "none";
}

Call the function as shown below.divToShow has to replaced by the ID of the div tag to be shown and divToHide has to replaced by the ID of the div tag to hide.

showHideDiv
('divToShow','divToHide');">Protection Area



No comments: