...

View Full Version : slight modification to a div toggler



canadianjameson
07-13-2007, 06:38 PM
Hi, i am currently using this div toggler to dynamically show links / text



var arrPrevDiv = [null, null];

function toggle(id, linkGroup) {

if (arrPrevDiv[linkGroup] != null) {
arrPrevDiv[linkGroup].style.display = "none";
}

var s = document.getElementById(id);

s.style.display = (s.style.display=="") ? "block" : (s.style.display=="none") ? "block" : "none";
arrPrevDiv[linkGroup] = s;
window.location.href='#'+ id;
window.status=''

}

It works very well and I can even have nested div toggles, unfortunately when I do nest them it displays improperly: like so:

www.enviromark.ca/head/YPP.htm
click "main points", then "Time for Mum", then "pics"
now click "comments"... and you'll see that the nested div doesn't re-hide.

How can we modify this to make it work?

here's the html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/pages.css" type="text/css"></head>
<script language="JavaScript" type="text/javascript" src="js/divToggler.js"></script>

<body>
<div id="pageHolder">
<div id="linksYPP">
<a href="#mainPointsYPP" onclick="toggle('mainPointsYPP', 0);">main points</a>
<a href="#commentsYPP" onclick="toggle('commentsYPP', 0);">comments</a>
<a href="#YPPmain" onclick="toggle('YPPmain', 0);">pics</a>
<a href="#whenWhereYPP" onclick="toggle('whenWhereYPP', 0);">operating info</a>
</div>
<div id="mainPointsYPP">
<a href="#eligibilityYPP" onclick="toggle('eligibilityYPP', 1);">Eligibility</a>
<a href="#parentBenefitsYPP" onclick="toggle('parentBenefitsYPP', 1);">Parental Benefits</a>
<a href="#childBenefitsYPP" onclick="toggle('childBenefitsYPP', 1);">Child Benefits</a>
<a href="#timeOffYPP" onclick="toggle('timeOffYPP', 1);">"Time Off For Mum"</a>

<ul id="eligibilityYPP"><li>Under 25? Have kids? Pregnant? Then come over and check out the Young Parents Program. We are a group of parents who meet for coffee, snacks, support and workshops twice a week. Lunch is also prepared for everyone. The atmosphere is very casual, friendly, and accepting. Come share your hopes, fears and problems, with like-minded young parents</li></ul>
<ul id="parentBenefitsYPP"><li>Parents are also offered a wide array of activities to participate in such as art therapy, dancing, and cooking. Also, there are workshops exploring parenting issues, health, wellbeing, etc. And on the last Friday of every month, access to free furniture, toys and clothing is available. 2 Bus tickets are given out at the end of every session</li></ul>
<ul id="childBenefitsYPP"><li>Children aged six months to five years are cared for within two separate groups. They are animated and entertained with age appropriate activities, such as arts and crafts, singing and stories. They get a chance to meet new friends and socialize with children their own age</li></ul>
<ul id="timeOffYPP"><li>Schedule for Mondays “Time Off For Mum” (Registration required)
<ul>
<li>Time off for Mum is coordinated by the group “Women on the Rise” in collaboration with the YPP, 10.30-3.30 stimulating activities for children age 2-5, hot lunch included for $2</li>
</ul>
<a href="#YPPmain" onclick="toggle('YPPmain', 2);">pics</a>
</ul>
</div>
<div id="commentsYPP">
<strong>Comments from Young Parents Program participants:</strong>
<br>
<br>
<br>
<p>"So many doors have opened up for me because of this program I highly recommend it to anyone who is a young parent." &nbsp;<font color="#990099">Jasmine</font></p>
<p>"I come here to get a break." &nbsp;<font color="#990099">Lina</font></p>
<p>"The new friendships I've made are great." &nbsp;<font color="#990099">Melanie</font></p>
<p>"This young parents program gives me confidence about becoming a new parent." &nbsp;<font color="#990099">Penelope</font></p>
<p>"Sometimes I just need someone to talk to. At YPP I find those people who all have felt the same at some time and can help." &nbsp;<font color="#990099">Paula</font></p>
<p>"YPP let s me feel good about being a young mother, and I LOVE it." &nbsp;<font color="#990099">Sara</font></p>
<p>"I come for the snacks." &nbsp;<font color="#990099">Jenni</font></p>
</div>
<img id="YPPmain" src="images/YPP/main.jpg">
<div id="whenWhereYPP">
<div id="locationYPP">
The Young Parents Program Center<br>
5775 St. Jacques Corner of Melrose<br>
Métro Vendôme / Bus # 90 west or 104
</div>
<div id="hoursYPP">
Opening Hours:<br>
Wednesday 1:00 p.m. to 4:30 p.m.<br>
Friday 1:00 p.m. to 4:30 p.m.<br>
Tel/Tél : 514.482.7910
</div>
</div>
</div>
</body>
</html>

vwphillips
07-13-2007, 11:44 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="http://www.enviromark.ca/head/css/pages.css" type="text/css"></head>
<script language="JavaScript" type="text/javascript">
<!--

// zxcToggle('eligibilityYPP',0,1)
// parameter 0 = the unique ID name of the element to open (string)
// parameter 1 = the menu group (digit)
// parameter 2 = the sub menu level (digit)


var zxcGrpAry=[];

function zxcToggle(zxcid,zxcgrp,zxclevel) {
var zxcobj=document.getElementById(zxcid);
if (!zxcGrpAry[zxcgrp]) zxcGrpAry[zxcgrp]=[];
for (var zxc0=0;zxc0<zxcGrpAry[zxcgrp].length;zxc0++){
if (zxcGrpAry[zxcgrp][zxc0][0]==zxcobj) zxcGrpAry[zxcgrp].splice(zxc0,1);
}
zxcGrpAry[zxcgrp].push([zxcobj,zxclevel]);
zxcobj.style.display =(zxcStyleValue(zxcobj,'display')=='none')?'block':'none';
for (var zxc1=0;zxc1<zxcGrpAry.length;zxc1++){
if (zxcGrpAry[zxc1]){
for (var zxc1a=0;zxc1a<zxcGrpAry[zxc1].length;zxc1a++){
if ((zxc1==zxcgrp&&(zxcGrpAry[zxc1][zxc1a][0]!=zxcobj&&zxcGrpAry[zxc1][zxc1a][1]>=zxclevel))||(zxc1!=zxcgrp)){
zxcGrpAry[zxc1][zxc1a][0].style.display='none';
}
}
}
}
}

function zxcStyleValue(zxcobj,zxcp){ // pass object and property, returns property value
if (zxcobj.currentStyle) return zxcobj.currentStyle[zxcp.replace('-','')];
return document.defaultView.getComputedStyle(zxcobj,null).getPropertyValue(zxcp.toLowerCase());
}

//-->
</script>
<body>
<div id="pageHolder">
<div id="linksYPP">
<a href="#mainPointsYPP" onclick="zxcToggle('mainPointsYPP',0,0);">main points</a>

<a href="#commentsYPP" onclick="zxcToggle('commentsYPP',1,0);">comments</a>
<a href="#YPPmain" onclick="zxcToggle('YPPmain',2,0);">pics</a>
<a href="#whenWhereYPP" onclick="zxcToggle('whenWhereYPP',3,0);">operating info</a>
</div>
<div id="mainPointsYPP">
<a href="#eligibilityYPP" onclick="zxcToggle('eligibilityYPP',0,1);">Eligibility</a>
<a href="#parentBenefitsYPP" onclick="zxcToggle('parentBenefitsYPP',0,1);">Parental Benefits</a>
<a href="#childBenefitsYPP" onclick="zxcToggle('childBenefitsYPP',0,1);">Child Benefits</a>
<a href="#timeOffYPP" onclick="zxcToggle('timeOffYPP',0,1);">"Time Off For Mum"</a>

<ul id="eligibilityYPP"><li>Under 25? Have kids? Pregnant? Then come over and check out the Young Parents Program. We are a group of parents who meet for coffee, snacks, support and workshops twice a week. Lunch is also prepared for everyone. The atmosphere is very casual, friendly, and accepting. Come share your hopes, fears and problems, with like-minded young parents</li></ul>

<ul id="parentBenefitsYPP"><li>Parents are also offered a wide array of activities to participate in such as art therapy, dancing, and cooking. Also, there are workshops exploring parenting issues, health, wellbeing, etc. And on the last Friday of every month, access to free furniture, toys and clothing is available. 2 Bus tickets are given out at the end of every session</li></ul>
<ul id="childBenefitsYPP"><li>Children aged six months to five years are cared for within two separate groups. They are animated and entertained with age appropriate activities, such as arts and crafts, singing and stories. They get a chance to meet new friends and socialize with children their own age</li></ul>
<ul id="timeOffYPP"><li>Schedule for Mondays “Time Off For Mum” (Registration required)
<ul>
<li>Time off for Mum is coordinated by the group “Women on the Rise” in collaboration with the YPP, 10.30-3.30 stimulating activities for children age 2-5, hot lunch included for $2</li>
</ul>
<a href="#YPPmain" onclick="zxcToggle('YPPmain',2,1);">pics</a>

</ul>
</div>
<div id="commentsYPP">
<strong>Comments from Young Parents Program participants:</strong>
<br>
<br>
<br>
<p>"So many doors have opened up for me because of this program I highly recommend it to anyone who is a young parent." &nbsp;<font color="#990099">Jasmine</font></p>

<p>"I come here to get a break." &nbsp;<font color="#990099">Lina</font></p>
<p>"The new friendships I've made are great." &nbsp;<font color="#990099">Melanie</font></p>
<p>"This young parents program gives me confidence about becoming a new parent." &nbsp;<font color="#990099">Penelope</font></p>
<p>"Sometimes I just need someone to talk to. At YPP I find those people who all have felt the same at some time and can help." &nbsp;<font color="#990099">Paula</font></p>
<p>"YPP let s me feel good about being a young mother, and I LOVE it." &nbsp;<font color="#990099">Sara</font></p>

<p>"I come for the snacks." &nbsp;<font color="#990099">Jenni</font></p>
</div>
<img id="YPPmain" src="images/YPP/main.jpg">
<div id="whenWhereYPP">
<div id="locationYPP">
The Young Parents Program Center<br>
5775 St. Jacques Corner of Melrose<br>

Métro Vendôme / Bus # 90 west or 104
</div>
<div id="hoursYPP">
Opening Hours:<br>
Wednesday 1:00 p.m. to 4:30 p.m.<br>
Friday 1:00 p.m. to 4:30 p.m.<br>
Tel/Tél : 514.482.7910
</div>

</div>
</div>
</body>
</html>

canadianjameson
07-13-2007, 11:50 PM
Hey Vic

Thanks a lot, I will implement it monday and get back to you, running out the door for the weekend.

Thanks again

vwphillips
07-13-2007, 11:57 PM
BTW
I don't do 'slight'

canadianjameson
07-17-2007, 04:51 PM
Haha, that is very true.

Alright, sorry for the delay but I'm implementing it now.

It took me a little while but I understand how to use the menu / submenu's now to get the effect I want :) I did however encounter two small glitches which I'm sure will be easy to fix

I will be giving a description of how I came across the bug, so if you can open a browser with the page loaded it would make it easier to follow. (www.enviromark.ca/head/YPP.htm)


Click 'Main Points', then click any link you wish, then click 'Main Points' again. It hides everything Would it be possible to have the script only close sub-menus IF the link clicked is already active?

This second one is a little harder for me to explain clearly... but i'll try. what is occurring is that when I set a particular div to be toggled by two different links on the page (i.e having two ways to get to the same thing), one of them doesn't work.

(see bold -- i removed some code to make it more readable)If I have both codes (bold), one of them wont show the div
<div id="linksYPP">
<a href="#mainPointsYPP" onclick="zxcToggle('mainPointsYPP',0,0);">main points</a>

<a href="#YPPmain" onclick="zxcToggle('YPPmain',2,0);">pics</a>
</div>
<div id="mainPointsYPP">
<a href="#eligibilityYPP" onclick="zxcToggle('eligibilityYPP',0,1);">Eligibility</a>
<a href="#parentBenefitsYPP" onclick="zxcToggle('parentBenefitsYPP',0,1);">Parental Benefits</a>
<a href="#childBenefitsYPP" onclick="zxcToggle('childBenefitsYPP',0,1);">Child Benefits</a>
<a href="#timeOffYPP" onclick="zxcToggle('timeOffYPP',0,1);">"Time Off For Mum"</a>

<ul id="eligibilityYPP"><li>Under 25? Have kids? Pregnant? Then come over and check out the Young Parents Program. We are a group of parents who meet for coffee, snacks, support and workshops twice a week. Lunch is also prepared for everyone. The atmosphere is very casual, friendly, and accepting. Come share your hopes, fears and problems, with like-minded young parents</li></ul>

<ul id="parentBenefitsYPP"><li>Parents are also offered a wide array of activities to participate in such as art therapy, dancing, and cooking. Also, there are workshops exploring parenting issues, health, wellbeing, etc. And on the last Friday of every month, access to free furniture, toys and clothing is available. 2 Bus tickets are given out at the end of every session</li></ul>
<ul id="childBenefitsYPP"><li>Children aged six months to five years are cared for within two separate groups. They are animated and entertained with age appropriate activities, such as arts and crafts, singing and stories. They get a chance to meet new friends and socialize with children their own age</li></ul>
<ul id="timeOffYPP"><li>Schedule for Mondays “Time Off For Mum” (Registration required)
<ul>
<li>Time off for Mum is coordinated by the group “Women on the Rise” in collaboration with the YPP, 10.30-3.30 stimulating activities for children age 2-5, hot lunch included for $2</li>
</ul>
<a href="#YPPmain" onclick="zxcToggle('YPPmain',0,2);">pics</a>

</ul>
</div>

Thanks a lot Vic, I really appreciate it :)

vwphillips
07-17-2007, 05:55 PM
* Click 'Main Points', then click any link you wish, then click 'Main Points' again. It hides everything
o Would it be possible to have the script only close sub-menus IF the link clicked is already active?

I don't understand.


This second one is a little harder for me to explain clearly... but i'll try. what is occurring is that when I set a particular div to be toggled by two different links on the page (i.e having two ways to get to the same thing), one of them doesn't work.



The href reloads the page

We have had this problem a number of times

use

<a href="#mainPointsYPP" onclick="zxcToggle('mainPointsYPP',0,0); return false">main points</a>


or


<input type="button" name="" value="Main" onclick="zxcToggle('mainPointsYPP',0,0);"></body>

canadianjameson
07-17-2007, 07:05 PM
I don't understand.

You know what... I just realized what was happening. If you click a link once it unhides the Div, but if you click it a second time it re-hides it. This is good, and I wasn't seeing it before. The only time I can see myself making use of this feature on purpose would be if I was giving people the option to show / hide something... and in that case I would need to be able to both hide & unhide a div, and change the text of the link from "show xyz" to 'hide xyz'... however if you want I can just msg you if / when I need to be able to do that. basically it would just require me being able to set multiple effects using one click. something like
onclick="zxcToggle('timeOffYPP',0,1, 'showHideTxt,0,0'); return false">. again if it's complicated you can leave it for now




The href reloads the page

We have had this problem a number of times

use

<a href="#mainPointsYPP" onclick="zxcToggle('mainPointsYPP',0,0); return false">main points</a>


I think it finally clicked :D I now understand why it needs to return false. I have added "...;return false"> to all of the links, however could that be worked into the actual script instead of needing to add it to every link? I assume it can because it is common to all links used.

Unfortunately adding the return false didn't solve the problem though :(

unless i did it wrong:



<div id="linksYPP">
<a href="#mainPointsYPP" onclick="zxcToggle('mainPointsYPP',0,0); return false">main points</a>
<a href="#commentsYPP" onclick="zxcToggle('commentsYPP',1,0); return false">comments</a>
<a href="#YPPmain" onclick="zxcToggle('YPPmain',2,0); return false">pics</a>
<a href="#whenWhereYPP" onclick="zxcToggle('whenWhereYPP',3,0); return false">operating info</a>
...
..
.


www.enviromark.ca/head/YPP.htm

vwphillips
07-17-2007, 07:26 PM
could that be worked into the actual script instead of needing to add it to every link?

with difficulty


Unfortunately adding the return false didn't solve the problem though

does for me

The only time I can see myself making use of this feature on purpose

It is the norm for menus

but


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="http://www.enviromark.ca/head/css/pages.css" type="text/css"></head>
<script language="JavaScript" type="text/javascript">
<!--

// zxcToggle('eligibilityYPP',0,1)
// parameter 0 = the unique ID name of the element to open (string)
// parameter 1 = the menu group (digit)
// parameter 2 = the sub menu level (digit)


var zxcGrpAry=[];

function zxcToggle(zxcid,zxcgrp,zxclevel) {
var zxcobj=document.getElementById(zxcid);
if (!zxcGrpAry[zxcgrp]) zxcGrpAry[zxcgrp]=[];
for (var zxc0=0;zxc0<zxcGrpAry[zxcgrp].length;zxc0++){
if (zxcGrpAry[zxcgrp][zxc0][0]==zxcobj) zxcGrpAry[zxcgrp].splice(zxc0,1);
}
zxcGrpAry[zxcgrp].push([zxcobj,zxclevel]);
zxcobj.style.display ='block';
for (var zxc1=0;zxc1<zxcGrpAry.length;zxc1++){
if (zxcGrpAry[zxc1]){
for (var zxc1a=0;zxc1a<zxcGrpAry[zxc1].length;zxc1a++){
if ((zxc1==zxcgrp&&(zxcGrpAry[zxc1][zxc1a][0]!=zxcobj&&zxcGrpAry[zxc1][zxc1a][1]>=zxclevel))||(zxc1!=zxcgrp)){
zxcGrpAry[zxc1][zxc1a][0].style.display='none';
}
}
}
}
}

function zxcStyleValue(zxcobj,zxcp){ // pass object and property, returns property value
if (zxcobj.currentStyle) return zxcobj.currentStyle[zxcp.replace('-','')];
return document.defaultView.getComputedStyle(zxcobj,null).getPropertyValue(zxcp.toLowerCase());
}

//-->
</script>
<body>
<div id="linksYPP">
<a href="#mainPointsYPP" onclick="zxcToggle('mainPointsYPP',0,0); return false">main points</a>

<a href="#YPPmain" onclick="zxcToggle('YPPmain',2,0); return false">pics</a>
</div>
<div id="pageHolder">
<div id="linksYPP">
<a href="#mainPointsYPP" onclick="zxcToggle('mainPointsYPP',0,0);">main points</a>

<a href="#commentsYPP" onclick="zxcToggle('commentsYPP',1,0);">comments</a>
<a href="#YPPmain" onclick="zxcToggle('YPPmain',2,0);">pics</a>
<a href="#whenWhereYPP" onclick="zxcToggle('whenWhereYPP',3,0);">operating info</a>
</div>
<div id="mainPointsYPP">
<a href="#eligibilityYPP" onclick="zxcToggle('eligibilityYPP',0,1);">Eligibility</a>
<a href="#parentBenefitsYPP" onclick="zxcToggle('parentBenefitsYPP',0,1);">Parental Benefits</a>
<a href="#childBenefitsYPP" onclick="zxcToggle('childBenefitsYPP',0,1);">Child Benefits</a>
<a href="#timeOffYPP" onclick="zxcToggle('timeOffYPP',0,1);">"Time Off For Mum"</a>

<ul id="eligibilityYPP"><li>Under 25? Have kids? Pregnant? Then come over and check out the Young Parents Program. We are a group of parents who meet for coffee, snacks, support and workshops twice a week. Lunch is also prepared for everyone. The atmosphere is very casual, friendly, and accepting. Come share your hopes, fears and problems, with like-minded young parents</li></ul>

<ul id="parentBenefitsYPP"><li>Parents are also offered a wide array of activities to participate in such as art therapy, dancing, and cooking. Also, there are workshops exploring parenting issues, health, wellbeing, etc. And on the last Friday of every month, access to free furniture, toys and clothing is available. 2 Bus tickets are given out at the end of every session</li></ul>
<ul id="childBenefitsYPP"><li>Children aged six months to five years are cared for within two separate groups. They are animated and entertained with age appropriate activities, such as arts and crafts, singing and stories. They get a chance to meet new friends and socialize with children their own age</li></ul>
<ul id="timeOffYPP"><li>Schedule for Mondays “Time Off For Mum” (Registration required)
<ul>
<li>Time off for Mum is coordinated by the group “Women on the Rise” in collaboration with the YPP, 10.30-3.30 stimulating activities for children age 2-5, hot lunch included for $2</li>
</ul>
<a href="#YPPmain" onclick="zxcToggle('YPPmain',2,1);">pics</a>

</ul>
</div>
<div id="commentsYPP">
<strong>Comments from Young Parents Program participants:</strong>
<br>
<br>
<br>
<p>"So many doors have opened up for me because of this program I highly recommend it to anyone who is a young parent." &nbsp;<font color="#990099">Jasmine</font></p>

<p>"I come here to get a break." &nbsp;<font color="#990099">Lina</font></p>
<p>"The new friendships I've made are great." &nbsp;<font color="#990099">Melanie</font></p>
<p>"This young parents program gives me confidence about becoming a new parent." &nbsp;<font color="#990099">Penelope</font></p>
<p>"Sometimes I just need someone to talk to. At YPP I find those people who all have felt the same at some time and can help." &nbsp;<font color="#990099">Paula</font></p>
<p>"YPP let s me feel good about being a young mother, and I LOVE it." &nbsp;<font color="#990099">Sara</font></p>

<p>"I come for the snacks." &nbsp;<font color="#990099">Jenni</font></p>
</div>
<img id="YPPmain" src="images/YPP/main.jpg">
<div id="whenWhereYPP">
<div id="locationYPP">
The Young Parents Program Center<br>
5775 St. Jacques Corner of Melrose<br>

Métro Vendôme / Bus # 90 west or 104
</div>
<div id="hoursYPP">
Opening Hours:<br>
Wednesday 1:00 p.m. to 4:30 p.m.<br>
Friday 1:00 p.m. to 4:30 p.m.<br>
Tel/Tél : 514.482.7910
</div>

</div>
</div>
<input type="button" name="" value="Main" onclick="zxcToggle('mainPointsYPP',0,0);"></body>
</html>

canadianjameson
07-17-2007, 07:35 PM
does for me
It works for the first click, but after that the script breaks. follow these steps and you'll see.

go to www.enviromark.ca/head/YPP.htm
click 'pics' --> it works, the picture displays
now click 'main points'
then click 'Time of for Mum'
then click the big blue 'pics' link. --> now neither 'pics' link works



I'll post about the other point in a second :D

canadianjameson
07-17-2007, 08:03 PM
regarding the return false integration -- scratch it, it's probably best that i have it in every link anyways to remind me of why it is needed.

I have added this into the script


zxcobj.style.display ='block';
// zxcobj.style.display =(zxcStyleValue(zxcobj,'display')=='none')?'block':'none'; // replace above to hide all submenus onclick

so that I may have both functionalities at my disposal in case of future need. Thanks :)

What was the verdict on the allowing multiple div toggles with one onclick?

vwphillips
07-17-2007, 10:30 PM
<script language="JavaScript" type="text/javascript">
<!--

// zxcToggle('eligibilityYPP',0,1)
// parameter 0 = the unique ID name of the element to open (string)
// parameter 1 = the menu group (digit)
// parameter 2 = the sub menu level (digit)


var zxcGrpAry=[];

function zxcToggle(zxcid,zxcgrp,zxclevel) {
var zxcobj=document.getElementById(zxcid);
if (!zxcGrpAry[zxcgrp]) zxcGrpAry[zxcgrp]=[];
for (var zxc0=0;zxc0<zxcGrpAry[zxcgrp].length;zxc0++){
if (zxcGrpAry[zxcgrp][zxc0][0]==zxcobj) zxcGrpAry[zxcgrp].splice(zxc0,1);
}
zxcGrpAry[zxcgrp].push([zxcobj,zxclevel]);
zxcobj.style.display =(zxcStyleValue(zxcobj,'display')=='none')?'block':'none';
for (var zxc1=0;zxc1<zxcGrpAry.length;zxc1++){
if (zxcGrpAry[zxc1]){
for (var zxc1a=0;zxc1a<zxcGrpAry[zxc1].length;zxc1a++){
if (((zxc1==zxcgrp&&(zxcGrpAry[zxc1][zxc1a][0]!=zxcobj&&zxcGrpAry[zxc1][zxc1a][1]>=zxclevel))||(zxc1!=zxcgrp))&&zxcobj!=zxcGrpAry[zxc1][zxc1a][0]){
zxcGrpAry[zxc1][zxc1a][0].style.display='none';
}
}
}
}
}

function zxcStyleValue(zxcobj,zxcp){ // pass object and property, returns property value
if (zxcobj.currentStyle) return zxcobj.currentStyle[zxcp.replace('-','')];
return document.defaultView.getComputedStyle(zxcobj,null).getPropertyValue(zxcp.toLowerCase());
}

//-->
</script>

canadianjameson
07-17-2007, 11:12 PM
Vic that is PERFECT!

I hope it didn't take too long to do :o

Thanks again, this is exactly what I needed.

I don't know if you want first crack but I posted a thread regarding a modification of a border-fading script that you wrote for me... i figured you might not want anyone messing with your baby but you :D If not that's alright, you've helped me so much I'm beginning to feel bad :p

canadianjameson
08-01-2007, 03:35 AM
A small afterthought addition:

Could we add a variable wherein if it is set, onclick the document title will change to the value of that variable?

ex:

onclick="zxcToggle('picsYPP',3,0,'Pictures of the YPP');

Thanks Vic. Sorry for the last-minute change :)

(p.s: it would need to work with the ajax content loader, i don't know if thats possible because it would require altering the <title> tag of the parent document...)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum