Search DominoPower's 11,441 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Advanced building of DHTML views with Internet Explorer (continued)

First, two global JavaScript arrays are defined. They are global because they are defined outside of any function. One has the names of the <div> IDs, and the other has the Name value of the images. That Name value comes from the "Name=" that I put on the first and second columns. I named the images so now I can refer to them by name. This is needed to change the icons in front of an expanded subcategory to be the twisty pointing to the right (EXPAND.GIF). If I didn't have the name value, I'd have to go through all the images and see if it's supposed to be expanded or collapsed. This way, I can just quickly reference the image I know I want to change. In the first example, this wasn't necessary because only the selected image was being changed. Now, other images may be changed, so we need to be able to quickly get to the correct image on the page.

After the global arrays are defined comes the function definition. Inside the function, loop through all the images on the page. If the image has the phrase "/icons/expand.gif" in it, then we know it's a twisty. This means you can have other images on the page that won't be affected by this (they won't be put into the array). Pull the "Name=" value out of the image and put it into the "imgNames" array. The image name is of the format "Img#" where # is the category number. Into the "tagNames" array we want "Cat#," so we put in the constant "Cat" followed by the image number after "Img" (i.e., starting with the fourth character). I'd like to point out that "imgNames.length++" increases the size of the array and then returns the value of that last entry. It's a quick way to append a value to an array of dynamic size.

OK, so now we have two arrays of the image names and their associated category names (the <div> tag ID's). Now, when a category is collapsed, we need to see if any other categories need to be collapsed as well. This goes into the doOutline function. That function now becomes:

function doOutline() {
var srcElement = window.event.srcElement;
if (srcElement.className == "Twisty") {
var targetID = srcElement.id + "Top";
var targetElement = document.all(targetID);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
if (srcElement.tagName == "IMG") {
srcElement.src = "/icons/collapse.gif";
}
} else {
targetElement.style.display = "none";
if (srcElement.tagName == "IMG") {
srcElement.src = "/icons/expand.gif";
}
for (var i=0; i<tagNames.length; i++) {
var imgName = imgNames[i];
targetID = tagNames[i] + "Top";
targetElement = document.all(targetID);
if ( (targetElement.style.display != "none") && (targetID.indexOf(srcElement.id) == 0) ) {
targetElement.style.display = "none";
document.images[imgName].src = "/icons/expand.gif";
}
}
}
}
}


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  Next »
Other articles you might like
Home > Internet Technologies > HTML and CSS (15 articles)
   Using a reusable code approach to HTML select option lists
   One reader's opinion on HTML mailing
   Keep lookin' good with Cascading Style Sheets
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Struggling with exporting Notes data to spreadsheets? No More!
Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino

  • Don't spend unproductive time maintaining different versions of the same spreadsheet
  • Preserve data integrity and security in multi-user environments
  • Create reports in minutes INSIDE Notes
  • Get freedom from iterative report requests, deliver self-serve capabilities

Experience Reporting, Dashboards, and Analysis INSIDE Notes.

Try IntelliPRINT NOW!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login