Java Reference
In-Depth Information
When descEl contains a value, you remove it from the descContainer element and change the
className property of the active tab to tabStrip-tab, changing its style to that of a tab in the normal
state.
Chapter 13
Exercise 1 Question
Using the Quicktime plug-in or ActiveX control, create a page with three links, so that when you click
any of them a sound is played. Use an alert box to tell the users who do not have QuickTime installed
that they must install it when they click a link.
The page should work in IE, Firefox, Safari, Chrome, and Opera. The method to tell QuickTime what
fi le to play is SetURL().
Exercise 1 Solution
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>Chapter 13: Question Answer</title>
<script type=”text/javascript”>
var plugInInstalled = false;
function play(fileName)
{
if (plugInInstalled)
{
document.audioPlayer.SetURL(fileName);
document.audioPlayer.Play();
}
else
{
alert(“You must have QuickTime installed to play this file.”);
}
return false;
}
function window_onload()
{
if (!window.ActiveXObject)
{
var pluginsLength = navigator.plugins.length;
for (var i = 0; i < pluginsLength; i++)
{
var pluginName = navigator.plugins[i].name.toLowerCase();
if (pluginName.indexOf(“quicktime”) > -1)
{
plugInInstalled = true;
Search WWH ::




Custom Search