•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 373,915 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,682 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 13870 | Replies: 1
![]() |
•
•
Join Date: May 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hello all:
I'm creating an image gallery that opens in hidden divs. Here's my javascript code:
<script type="text/javascript">
<!--
function popupSwitch(szDivID, iState)
{
if(document.layers)
{
document.layers[szDivID].visibility = iState ? "show" : "hide";
}
else if(document.getElementById)
{
var obj = document.getElementById(szDivID);
obj.style.visibility = iState ? "visible" : "hidden";
}
else if(document.all)
{
document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
}
}
// -->
</script>
If the user clicks on this link
<a href="javascript:;" onClick="popupSwitch('popup1',1);" value="Show Div"><img src="images/exterior1_th.jpg" width="127" height="89" border="0"><br>Exterior Photo One</a>
it displays this div:
<div id="popup1" class="popup">
<div align="center"><img src="images/exterior1.jpg"><br>
<b><a href="javascript:;" onClick="popupSwitch('popup1',0);" value="Hide Div"><font size="2">Close
Window [X]</font></a></b><br>
</div>
</div>
As you can see, when the user clicks "Close Window" it will hide the div.
Here's what I'm having trouble with:
if the user clicks on another link to show another DIV without closing the previous one, I need a fuction that will hide all DIV's that might be visible.
I'm a little stumped on this one. Help :-)
I'm creating an image gallery that opens in hidden divs. Here's my javascript code:
<script type="text/javascript">
<!--
function popupSwitch(szDivID, iState)
{
if(document.layers)
{
document.layers[szDivID].visibility = iState ? "show" : "hide";
}
else if(document.getElementById)
{
var obj = document.getElementById(szDivID);
obj.style.visibility = iState ? "visible" : "hidden";
}
else if(document.all)
{
document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
}
}
// -->
</script>
If the user clicks on this link
<a href="javascript:;" onClick="popupSwitch('popup1',1);" value="Show Div"><img src="images/exterior1_th.jpg" width="127" height="89" border="0"><br>Exterior Photo One</a>
it displays this div:
<div id="popup1" class="popup">
<div align="center"><img src="images/exterior1.jpg"><br>
<b><a href="javascript:;" onClick="popupSwitch('popup1',0);" value="Hide Div"><font size="2">Close
Window [X]</font></a></b><br>
</div>
</div>
As you can see, when the user clicks "Close Window" it will hide the div.
Here's what I'm having trouble with:
if the user clicks on another link to show another DIV without closing the previous one, I need a fuction that will hide all DIV's that might be visible.
I'm a little stumped on this one. Help :-)
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Spellchecker Remote (JavaScript / DHTML / AJAX)
- I hate Firefox! (JavaScript / DHTML / AJAX)
- Can anyone PLEASE help with this? (Troubleshooting Dead Machines)
- HELP lost all icons (Windows NT / 2000 / XP / 2003)
- wanna help..how to avoid default context menu (JavaScript / DHTML / AJAX)
- Folder Locking and Hiding in Windows XP (Computer Science and Software Design)
- New Window (HTML and CSS)
- how to remove the system volume icon from taskbar (Windows NT / 2000 / XP / 2003)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Javascript, Form fields validation and submit
- Next Thread: Dynamically modifying the CSS attributes through Javascript



Linear Mode