Archive for August 2009

Using Javascript to hide single/multiple div tags with the same name Part 2

Recently I was asked by a comment from my previous post Using Javascript to hide single/multiple div tags with the same name on how to get multiple buttons to control multiple div tags. For example, 2 div classes need to be hidden or shown with 2 different buttons controlling them. Turns out this is fairly simple. Basically you can use some previous code and alter some variable names in the javascript, but to make things simple here is the code.

function getElementsByClass(searchClass, domNode, tagName) {
     if (domNode == null) domNode = document;
     if (tagName == null) tagName = '*';
     var el = new Array();
     var tags = domNode.getElementsByTagName(tagName);
     var tcl = " "+searchClass+" ";
     for(i=0,j=0; i<tags.length; i++) {
          var test = " " + tags[i].className + " ";
          if (test.indexOf(tcl) != -1)
               el[j++] = tags[i];
     return el;
var hidden = false;
function toggle_hideme1() {
     hidden = !hidden;
     var newDisplay;
     if(hidden) {
          newDisplay = 'block';
          newDisplay = 'none';
     var showfirst = getElementsByClass("div_class_name", null, "div");
     for(var i = 0; i < showfirst.length; i++) {
          showfirst[i].style.display = newDisplay;
var hiddenb = false;
function toggle_hideme2() {
     hiddenb = !hiddenb;
     var newDisplay;
          newDisplay = 'block';
          newDisplay = 'none';
     var showsecond = getElementsByClass("div_class_name", null, "div");
     for(var k = 0; k < showsecond.length; k++) {
          showsecond[k].style.display = newDisplay;

For the variables ‘showfirst’ and ‘showsecond’ you can call them what ever you want, just make sure they stay the same in only one function, not two. Be sure to change ‘div_class_name’ to a custom name for each field.

Also, these are setup to be hidden first, you can change that by swapping the ‘newDisplay = ‘ lines.

For the HTML code we are going to use check boxes. We need two boxes each with names that call the function.

<input type="checkbox" name="showone" id="showone" value="showone" onClick="toggle_hideme1('showone');"><br />
<input type="checkbox" name="showtwo" id="showtwo" value="showtwo" onClick="toggle_hideme2('showtwo');"><br />

If you want the boxes checked to start first swap the ‘newDisplay =’ lines, and use this.

<input type="checkbox" name="showone" id="showone" value="showone" onClick="toggle_hideme1('showone');" CHECKED><br />

As in my previous post you need to put what ever will be shown or hidden in a div class tag.

<div class="div_class_name" style="display: none;">

The style hides everything in the class until the box is checked.

That will start the boxed checked, when you un-check it the data in all div classes with that name will hide (remember the ‘div_class_name’? that’s what we are working with).

I wrote this up in just a couple minutes, so I truly help it makes scene. You can check out an example of how it works here.

Defcon 17 thoughts

First off, I want to say that Spyder wrote an excellent article that I’m kinda taking my ideas from. Check it out at

This was my 4th year attending Defcon (all in a row!) and was by far the best year. I’m going to try putting everything in chronological order, lets see how well I do.

It all started shortly after arriving at the Riviera Hotel and Casino in Las Vegas on Thursday, July 30th. We has just gotten to our room and started relaxing after the crappy plane ride when we realized that it was time to prepare for the Toxic BBQ. Having a good friend that lives in Vegas is very handy at times like these. After going to Walmart to pick up the items everyone forgets (Thanks again for paying for everything Spyder) like: Water, Ice, Napkins, Paper Plates, and Plastic Silverware, we arrived at Sunset Park. Everyone was very grateful to us for bringing ice and water. Many were dehydrated and were happy for cold clean water. We all had a great time, good food, good friends. We even ran into Winn and his daughter Ashley (maker of Hackers Are People Too). When it was time to go we piled back into the truck (with about 9 or so people in the back that needed a ride) and went back to the Riviera. It was pretty quiet after that. We all thought it would be a good idea to take it easy so we could get up early for the fun.

Friday morning was just like any other… except having to stand in line for a few hours to try and exchange our paper badges for real ones. A special thanks there goes to my buddie Mikey for getting in line early. I don’t want to go into too much detail on the days, mostly the events and special occasions.

This year I was fortunate enough to meet Johnny Long who was there to do a talk about his charity work in Uganda. If you don’t know about it goto and help out! The next day (after winning a little extra cash in the casino) I got a book called “Stealing the Network: The Complete Series Collector’s Edition” and got it signed my Johnny Long and Ryan Russell, but unfortunately Timothy Mullen wasn’t there. A special thanks goes to Ryan Russell, I can’t wait to read the book, and thank you Johnny Long for also signing my book.

I was to talk a little bit about Hacker Jeopardy. As usual Winn was awesome, and Gmark did a great job this year. As Spyder said in his post, Bansee is no longer Vynl Vanna. She always did a great job, she will be missed. The questions this year were kinda lame, Spyder and I talked to Winn about it and gave a few suggestions (they were all Spyder’s ideas), lets see if they use them next year.

Moxie’s talk about SSL was a real eye opener. Spyder has been blogging about it for quite some time, but seeing it in the presentation was a real eye opener. It’s true, security is an illusion. Scary thought, but it’s true, I have seen it with my own eyes.

Adam Savage from Mythbusters did a talk, I missed it. I wanted to see it. After the talk he was signing autographs. I found out from defcon’s twitter feed. The instant it was posted I got it on my phone and rushed to the War Room. I got there a few minutes late and a Goon kept me out of the line. If I had a beer for him he probably would have let me in, but I don’t drink beer so I was out of luck.

I was fortunate enough (also thanks to Spyder) to meet Keven (DJ Shadowvex) and talk with him for a bit. I enjoy his music and always look forward to next year’s disk. I also meet up with a few of his friends, but I’m bad with names. Sorry guys!

Over all this year was a great year and I look forward to going back next year. I think I have started to get myself known to some of the best people at Defcon and I know they will recognize me next year and I can’t wait to see them again. Special thanks to Spyder. If it wasn’t for you I’m not sure I would have made it since I couldn’t afford a room by myself. Special thanks to Mikey. You are an awesome friend. I couldn’t ask for a better one. You know how to get around town and even help me win a few extra bucks on the video poker machine. Thank you for picking us up and dropping us off at the airport, and for the ride to and from the Toxic BBQ. Thanks for everything! I feel very fortunate that I have good friends and good times. By the end I didn’t want to leave Vegas since I was having such a great time, but all good things must some to and end. So I went home and took a nap.

What was your Defcon 17 experience like? Did you meet me? Who did you meet? What fun things did you do? I was to hear all about it.