473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem With Sub-Popups

Hello,

I have a popup problem.
When a popup is opened, I want all other popups to close immediatly.
(except for its self and it's child popups)

Here is my code:
code:
[HTML]<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>

<head>
<title>Popup Problem</title>
<style type="text/css">
table.popup {
font-size:100%;
background:white;
border:solid black 1px;
position:absolute;
visibility:hidden;
}
</style>
</head>

<body>
<script type='text/javascript'>
var closeTimer = '';
var closeTimerSub = '';

<!-- Show or Hide an Element -->
function show_element(element, sub) {
document.getElementById(element).style.visibility= "visible";
<!-- Close Timers -->
if(closeTimer && sub != 'sub') { window.clearTimeout(closeTimer); closeTimer = null; }
if(closeTimerSub && sub == 'sub') { window.clearTimeout(closeTimerSub); closeTimerSub = null; }
<!-- Imediatly Close Other Elements -->
hide_elements_now(element); }

<!-- Imediatly Hide Elements -->
function hide_elements_now(element) {
x=document.getElementsByTagName('*');
for(i=0;i < x.length;i++) {
if (x[i].id != element && x[i].id != '') {
// Temporary - Hide all table popups (children don't open because they are closed immediatly)
x[i].style.visibility="hidden";

// Hide all tables popups except if child
//for(var n=0; n < document.getElementById(element).childNodes.length ; n++) {
// if (x[i].id != document.getElementById(element).childNodes[n])
// x[i].style.visibility="hidden";
//}
}
}
}

<!-- Hide an Element and remove form field focus (with time delay) -->
function hide_element(element,sub) {
if (sub == 'sub') closeTimerSub = window.setTimeout('hide_elements_focus(\''+element +'\');', 500);
else closeTimer = window.setTimeout('hide_elements_focus(\''+element +'\');', 500); }
function hide_elements_focus(element) {
if (element) document.getElementById(element).style.visibility= "hidden";
if (document.getElementById(element).style.visibility != 'visible') document.forms[0].elements[0].focus(); }
</script>

<table>
<tr>
<td onmouseover="show_element('table_id1', '');" onmouseout="hide_element('table_id1', '');">
ParentTable1
<table class='popup' id='table_id1'>
<tr>
<td onmouseover="show_element('subtable_id1', 'sub');"
onmouseout="hide_element('subtable_id1', 'sub');">
SubTable1
<table class='popup' id='subtable_id1'>
<tr><td>Sub Content</td></tr>
</table>
</td>
<td onmouseover="show_element('subtable_id2', 'sub');"
onmouseout="hide_element('subtable_id2', 'sub');">
SubTable2
<table class='popup' id='subtable_id2'>
<tr><td>Sub Content</td></tr>
</table>
</td>
</tr>
</table>
</td>
<td onmouseover="show_element('table_id2', '');" onmouseout="hide_element('table_id2', '');">
ParentTable2
<table class='popup' id='table_id2'>
<tr>
<td onmouseover="show_element('subtable_id3', 'sub');"
onmouseout="hide_element('subtable_id3', 'sub');">
SubTable3
<table class='popup' id='subtable_id3'>
<tr><td>Sub Content</td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

</body></html>
[/HTML]

The problem is here:
Expand|Select|Wrap|Line Numbers
  1. // Temporary - Hide all table popups (children don't open because they are closed immediatly)
  2. x[i].style.visibility="hidden";
  3.  
  4. // Hide all tables popups except if child (can't get it to work!)
  5. //for(var n=0; n < document.getElementById(element).childNodes.length; n++) {
  6. // if (x[i].id != document.getElementById(element).childNodes[n])
  7. // x[i].style.visibility="hidden";
  8. //}
Jun 29 '07 #1
1 1614
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

So what exactly is the problem? Do you get any errors?
Jul 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Jack | last post by:
How would I add a variable that I will assign to a list of $_POST variables that I extract from a form? My form passes a value for $q. That works fine. What I want to do is run an if/else on it...
6
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query...
1
by: Kris van der Mast | last post by:
Hi, been a while since I posted a question myself instead of trying to help others out. I'm refactoring an existing web app that uses dynamic loading of user controls and a lot of...
0
by: Bruin | last post by:
Hi All, I'm having a problem with MDI child forms when the reference to the MDI Parent is set in a Control library. (Sorry for the long post) I have an control library assembly which holds all...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
2
by: **Developer** | last post by:
I've been asking about a Menu problem I have without results. So here is a test case I've developed that shows the problem. Simply create a soultion with one project containg one form and...
5
by: Dany C. | last post by:
We have install a valid SSL certificate issued to www.mycompany.com on our web server running IIS 6.0 / win2003 SP1. Then we have created a sub domain pointing to the same server for our web...
0
by: anandv81 | last post by:
Hi, I encountered a strange problem while working on an application, the problem goes like this. I am generating a few textboxes at runtime at the server side and added to a placeholder, a...
8
by: sara | last post by:
I have a report that runs fine with data. If there is no data, I have its NO Data event sending a MsgBox and cancelling the report. Then it seems I still get the 2501 message on the Open Report...
11
by: eBob.com | last post by:
I have this nasty problem with Shared methods and what I think of as "global storage" - i.e. storage declared outside of any subroutines or functions. In the simple example below this "global"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.