Archive for the ‘DHTML’ Category

workaround for entity bug (?) in tabber

Tuesday, February 6th, 2007

A user of my tabber script discovered that when his tab headings had an ampersand character like this:

<h2>Me &amp; My Shadow</h2>

Then the tab control displayed “&amp;” instead of a single ampersand character.

It looks like this occurs because the JavaScript DOM function document.createTextNode() does not convert entities. However, it looks like innerHTML does convert entities, so to fix your problem find the following line in tabber.js:


and replace with the following:

DOM_a.innerHTML = t.headingText;

I’ll think about this some more and if I can’t find any bad side effects I’ll add to the tabber code.

JavaScript tabbifier v1.7 new features

Monday, April 10th, 2006

I just released a new version of my JavaScript tab interface software.

New Features

  • Can automatically set a unique id for each tab navigation link, which allows you to individually style each tab.
  • Includes a “minimized” version of the code (with comments and whitespace removed, for extra-fast loading).

JavaScript tab interface with persistent tabs

Friday, April 7th, 2006

Now with yummy cookies!

I added an example page showing how you can use the new onLoad and onClick function hooks in my JavaScript tabifier to make the tabs persistent (using browser cookies).

That is, if you leave the page and come back later, the tab you previously selected will still be selected.

Bookmarklet: sort all drop-down select lists on a page

Tuesday, April 4th, 2006

Some of my co-workers got stuck using a poorly-designed web application that has huge drop-down select lists. Unfortunately the people who designed this web app didn’t forsee the need to actually present the list items in any particular order, so its nearly impossible to find anything.

I made the following bookmarklet to sort all the select lists on the page. It’s probably not much use to anyone else, but at least I got to learn how to make a bookmarklet. Unfortunately it has to work in IE, which has a strict limit on the size of bookmarklets, so I had to keep it very simple.

SortSelect bookmarklet
Bookmark this link then click it on a page that has one or more select elements. The select lists will be sorted alphabetically. Tested in Firefox and IE6.

JavaScript tabbifier v1.6 new features

Monday, April 3rd, 2006

I just released a new version of my JavaScript tab interface software.

New Features

  • You can set a custom onLoad function to be called after the tab interface has finished initializing.
  • You can set a custom onClick function to be called when the user clicks a tab. In addition to performing any other actions, this function can stop the tab from changing.

Learn CSS positioning in ten steps

Tuesday, March 28th, 2006
CSS positioning

Here’s an interactive tutorial I’m working on:

Learn CSS Positioning in ten steps

I’m using it to give some CSS and HTML training today. It uses a customized version of my JavaScript tabs interface and triggers a styleswitcher each time you switch tabs, so you can see the CSS change right on the page.

It’s a work in progress, so let me know if you have any suggestions.

JavaScript tabbifier v1.5 new features

Sunday, March 26th, 2006

I just released a new version of my JavaScript tab interface software. It has some new features that make it crazy-easy to use, plus I eliminated a memory leak in the IE browser (damn you Microsoft!).

New Features

  • You can set the tabberOptions global variable before you include tabber.js to change any of the tabber settings.
  • You no longer have to specify a title for each tab – it automatically finds heading elements in the body of the tab. Of course you can still specify a title if you don’t have headings or to override the title of the tab. And if you don’t do either it automatically numbers the tabs. See also tabberOptions.titleElements and tabberOptions.titleElementsStripHTML.
  • Removes the title attribute from the tab so it does not appear as a tooltip when you mouseover the body of the tab. See also tabberOptions.removeTitle.
  • You can prevent tabber from running automatically in the onload event. See tabberOptions.manualStartup.
  • Fixed a small memory leak that appeared in the IE web browser.

Oh what tangled webs we weave…

Wednesday, March 15th, 2006

Because I didn’t want to foul up the namespace in my JavaScript tabber, I attached the tabber object directly to the DOM element it was controlling, then I had to add several “pointers” back and forth between the object and various DOM elements so they could get to each other without relying on any variables. When you look at it like this, it seems rather complicated:

Tabber diagram

I wonder if there are any issues with “memory leaks” due to IE’s faulty garbage collection… let me know if you notice anything.

Update: Hold the presses, I found a few more links. Some of these pointers are not used except when creating new elements to add into the DOM, so I can probably just switch those to use local variables. It shouldn’t matter, but with IE’s faulty garbage collection, who knows if it might cause problems.

Tabber diagram 2

Update :o h good god, the squiggly lines have taken over!