codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  visible/invisible divs  msadmin at 21:56 on Saturday, October 22, 2005
 

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.



  Re: visible/invisible divs  slip at 08:52 on Friday, March 10, 2006
 

div1.style.display = "none"; //hides the div1
div2.style.display = "block"; //shows the div2

Maybe this will help you!

  Re: visible/invisible divs  msadmin at 09:20 on Friday, March 10, 2006
 

Thank you.

How would I implement that code, where I should say ?

  Re: visible/invisible divs  slip at 09:29 on Friday, March 10, 2006
 

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.

  Re: visible/invisible divs  msadmin at 10:04 on Friday, March 10, 2006
 

ahh thank you ...

you kick,

take care ...








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Digital.Canal.Software.V2013
•  Altair_HyperWorks_12.0.1_Win64
•  Global.mapper.V15.0
•  ESI.PAM-RTM.V2010.0
•  KISSsoft.03.2013E.SP5
•  Technical.Toolboxes.Pipeline.Toolbox.2013.Enterprise.v15.0.0
•  Simprotek.Simprosys.V3.0
•  Ricardo.SABR.V6.0p1
•  PSIM.V9.2


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2013