Category: Javascript

Javascript testing for NaN: why doesn’t !=”NaN” work?

A couple of weeks ago, I was working on a custom HTML wrapper for Captivate quizzes that would behave one way if a score were already stored for that quiz, and another if the score were non-existent or zero.

So, how best to test for the existence of a score? Usually I test for the existence of a value with


if (typeof foo != "undefined"){do something}

Continue reading

Enable the Debug Menu in Safari

I find the new debugging tools in Safari almost as useful as Firebug. There’s a Web Inspector that lets you see exactly how the HTML is formed, a Javascript console that lets you see errors and debugging messages written into the code and much more.

But to use them you must enable the Debug menu in Safari. Open Safari preferences in the Safari Menu, click Advanced, and select Show Develop menu in menu bar.

Continue reading

How to override the !important CSS style attribute using Javascript

I’ve worked on a few projects where a CSS style on some page element has been specified as “!important” and it interferes with the way the page functions. Ordinarily, I would just change the original style, but sometimes I don’t have control over the stylesheet or script that is generating the style. One example is a recent project where an embedded Captivate player is written to a custom HTML wrapper at by the javascript SWFObject.js. SWFObject writes style attributes to the page dynamically to hide the Captivate player as required until it is fully loaded:

object, embed {
              visibility:hidden !important;
}
Continue reading

Using the Qualtrics API with PHP and javascript to create custom reports

Qualtrics.com is an extraordinarily full-featured online survey application that offers nearly every type of built-in report on your survey data you could ever want. But eventually, there comes a time when nothing but a custom report will do. Or you may want to integrate Qualtrics data into another application. For those times, Qualtrics has an extensive API which allows access to both data and functionality.

Qualtrics University doesn’t have many details of how to use the API, so to help you get started, I’m providing an example of how I used the Qualtrics API with a PHP proxy and Adobe’s Spry Framework to build a simple custom report.


Continue reading

Date-controlled random rotating banner script

This script text and HTML from an XML listing, based on the end date. It scans through the list, finds the first section with an end-date greater than today’s date, then pulls random banner text/HTML from that section. The example shown here uses a flat color banner with white text, but you could also use this same script to generate image or flash-based banners. I’ve also added a nice jQuery fade-in effect but that is optional.

View Demo

Download source files

Continue reading

A SCORM-Ready Template: Part 5A. Captivate Quizzes – Introduction

Although Captivate has its own SCORM interface, its reliability in our LMS over the last few years has become increasingly problematic. Data gets lost, quizzes score incorrectly, or do not complete at all, and there is a lot of frustration. 

At the same time, there has been increasing demand from subject matter experts and educators for inexpensive, easy to learn tools like Captivate that leverage their Powerpoint skills but have plenty of flexibility and options for interactivity. So something had to be done to make Captivate useful again.

What I decided to do was to turn over all the SCORM communication for Captivate activities to our HTML template, which doesn’t have the communication issues of the Adobe products. Using the SCORM template as a wrapper does not add a lot of work to a project, in fact, it requires only one line of code to add a scored Captivate or Presenter quiz to a template-based learning module.

Any type of scored Captivate file will work – both question slides and interactive slides. The module can handle one or more Captivate quizzes, either by themselves, or in combination with other types of content and quizzes, such as Questionmark Perception or the template-based interaction quizlets.

Continue reading