Category: Snippets

Using toggle javascripts to build an FAQ page.

FAQ pages are sometimes requested in our learning modules so we’ve built in the scripts to create an easy- to-read, easy-to-use FAQ by applying simple CSS classes to elements on the page. When the FAQ page loads, all the questions appear in a collapsed view which can be quickly scanned.

Screen shot 2009-10-23 at 3.21.54 PM.jpg

On clicking any question, its associated answer expands and pushes the rest of the questions down. When another question is clicked, the first answer closes and the new answer opens up.

Screen shot 2009-10-23 at 3.22.00 PM.jpg

Here’s how to add this type of FAQ to your own HTML pages.


Continue reading

JW FLV player that switches playlists on the fly

The JW FLV player is a versatile, customizable and scriptable flash video player, available from Longtailvideo.com. The player was recently upgraded, and many details in the scripting and playlists had to change to remain compatible. I’m posting examples of some of the players I’ve created lately, using the latest version of the player and SWFObject.

Versions

  • Player: JW FLV player 4.6
  • SWFObject: 2.1
  • Red5 Streaming server using RTMPT or RTMP
  • This is an example of a current-version player that changes playlists on the fly when you click a link or button.

    I can’t show you a working demo because I don’t have an external Red5 server but here is how it looks. When the page loads, the player loads the first playlist.

    Safari003.jpg

    Continue reading

    JW FLV player 4.6: Two or more players on a page

    The JW FLV player is a versatile, customizable and scriptable flash video player, available from Longtailvideo.com. The player was recently upgraded, and many details in the scripting and playlists had to change to remain compatible. Since it can be difficult to figure out the details of the necessary changes, I’m posting examples of some of the players I’ve created lately, using the latest version of the player and SWFObject.

    Versions

    • Player: JW FLV player 4.6
    • SWFObject: 2.1
    • Red5 Streaming server using RTMPT or RTMP

    This is an example of how to put two or more JW FLV players on a page, side by side. I can’t show you a working demo because I don’t have an external Red5 server but here is how it looks.

    Picture 35.jpg

    Continue reading

    dotProject Recipe: Add journal entries from the project view page

    NOTE (07-02-08): The modified Journal module has now been updated to work with v. 2.x of dotProject.

    J. Christopher Pereira created a journal module which is quite handy: it lets you add notes to projects – any type of note, without creating a task.

    The module is very useful, but a coworker requested that we modify it so you could add a journal note without ever leaving the project view page. Instead of a new window opening to enter the journal note, you simply enter the note into a text box that is always visible on the project view page.

    You just enter text in the new text field, hit “save”…

    Continue reading

    Getting the value of a variable on the opener page from a popup window

    How do you use javascript to get the value of a variable on the opener page, from a popup window? Use “window.opener.variablename“. This will work as long as the pages are in the same domain.

    It consists of 2 pages. On the first page, a variable “timer” has been defined, and it automatically increments upward every 5 seconds. The current value is displayed in a div on the opener page.

    Continue reading

    Use ABCpdf to generate pdfs of multi-paged html documents

    I maintain a library of learning modules which are constantly under development and revision. Our users often want PDFs to print out or view off-line, but we can’t maintain up-to-date PDF’s of each module manually. We needed a way to make on-demand PDFs of whatever the current state of the module is when the pdf is requested.

    After looking at many pdf solutions I settled on “ABCpdf ASP 6.0” by WebSuperGoo.com.

    ABCpdf has the advantages of fairly low cost (about $400.00 for one server, or FREE if you link back to them), a better HTML-rendering engine than most, and an easy to learn API, so you can write custom dynamic PDF applications.

    Continue reading