|
Hi everyone, im new to the board.
Im looking around still for a way to make one div visible at a time, so with a click of a link, the div with the link inside it disapears and the new div replaces it at its exact location.
i've seen this done at one website but can't find it right now, still searching, any help with this is awsome.
Thanks in advance.
Dave.
|
|
|
div1.style.display = "none"; //hides the div1
div2.style.display = "block"; //shows the div2
Maybe this will help you!
|
|
|
Thank you.
How would I implement that code, where I should say ?
|
|
|
Here is a sample code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<div id="1" style="width : 100px; height : 100px; border : solid 1px;"><a href="#" onclick="hide_show(); return false">Hi!</a></div>
<div id="2" style="width : 100px; height : 100px; border : solid 1px; display : none;">Bye!</div>
</body>
<script>
var div1 = document.getElementById("1");
var div2 = document.getElementById("2");
function hide_show () {
div1.style.display = "none";
div2.style.display = "block";
}
</script>
</html>
You should mention the following:
<a href="#" onclick="hide_show(); return false">Hi!</a>
As you see I call hide_show function when the link is clicked. This function uses the coded I have provided before.
|
|
|
ahh thank you ...
you kick,
take care ...
|
|
|
|
|
|
|
|