Previous | Next |
The Dynamic HTML Sample consists of two Web pages, a series of GIF images, and the Clip1.asf file. The Default.htm page contains a Windows Media Player control, which starts playing Clip1.asf as soon as the page is opened, and various other frames and controls for displaying text and the DHTML events. A row along the lower section of the page displays your progress through the content. Click the Details buttons, which pop up in the row, to open a second page that displays the scripting used to implement the DHTML shown on the Default.htm page.
As Clip1.asf is played back, the Windows Media Player control reads script commands contained in the file, and sends them to the browser at the appropriate times. Each script command contains two text strings. The first string is passed to the browser in a ScriptCommand event as the variable bstrType; the second is passed as bstrParam.
When you click a Details button, one of the first lines in the JavaScript code is similar to if (bstrType = = “eventnumber1”)
. An If statement is the mechanism that is almost always used when handling script commands in a Web page. In this case, when bstrType is equal to eventnumber1, then the code within that If statement is executed.
The DHTML Sample also demonstrates how you can enhance the look of your Web page by the creative placement and graphic treatment of Windows Media Player. In this case, the Windows Media Player display and controls are hidden, and transport control methods are sent to it using JavaScript and a custom button bar.
Expanding on this Sample
DHTML provides you with a powerful tool for enhancing your Web site. For example, with Windows Media Technologies components and DHTML, you can do the following:
eventnumber3
The command in the script command is:
document.all.DHTMLTitle.style.visibility =
"hidden";document.all.slide2.style.visibility =
"hidden";move(dlogo,20,20,5);
In JavaScript on the Web page, Default.htm, the command text in the script command becomes the argument in an eval function. The script command runs the move() function and changes the visibility attribute of two images. The following is a portion of Default.htm:
else if (bstrType == "eventnumber3")
{
eval(bstrparam);
document.all.descript.innerText = "In this third event, the code is embedded in the .asf file to run the move(); function as well as the code to change the 'visibility' attibute of two images.";
…
}
For more information, see Windows Media Presenter and Enhancing ASF content in the Windows Media Tools Documentation.
See Also
Using the DHTML Sample, Windows Media Technologies Solutions Samples
Previous | Next |