我有一个 xml 文件,其中包含一些代码,例如:
<?xml version="1.0"?>
<layout>
<group position="left">
<button name="play" />
<text name="elapsed" />
</group>
<group position="center">
<slider name="time" />
</group>
<group position="right">
<text name="duration" />
<button name="blank" />
<button name="mute" />
</group>
</layout>
我想将 onclick 事件添加到“播放”按钮,所以我尝试了-
<button name="play" onclick="test();" />
<button name="play" onclick="alert('ok');" />
<button name="play" onclick="javascript:test();" />
但这些都没有奏效。我应该如何在那里使用 onclick 事件?
-谢谢。
编辑: 我使用的是 jwplayer 5.2 pro,xml 文件用于播放器皮肤。
<?xml version="1.0"?>
<skin version="1.1" name="Glow" author="LongTail Video">
<components>
<component name="controlbar">
<settings>
<setting name="margin" value="0" />
<setting name="fontsize" value="11" />
<setting name="fontcolor" value="0xEEEEEE" />
<setting name="buttoncolor" value="0xEEEEEE" />
<setting name="backgroundcolor" value="0x990000" />
</settings>
<layout>
<group position="left">
<button name="play" />
<text name="elapsed" />
</group>
<group position="center">
<slider name="time" />
</group>
<group position="right">
<text name="duration" />
<button name="blank" />
<button name="mute" />
</group>
</layout>
<elements>
<element name="background" src="background.png" />
<element name="blankButton" src="blankButton.png" />
<element name="fullscreenButton" src="fullscreenButton.png" />
<element name="fullscreenButtonOver" src="fullscreenButtonOver.png" />
<element name="muteButton" src="muteButton.png" />
<element name="muteButtonOver" src="muteButtonOver.png" />
<element name="pauseButton" src="pauseButton.png" />
<element name="pauseButtonOver" src="pauseButtonOver.png" />
<element name="playButton" src="playButton.png" />
<element name="playButtonOver" src="playButtonOver.png" />
<element name="timeSliderBuffer" src="timeSliderBuffer.png" />
<element name="timeSliderCapLeft" src="timeSliderCapLeft.png" />
<element name="timeSliderCapRight" src="timeSliderCapRight.png" />
<element name="timeSliderProgress" src="timeSliderProgress.png" />
<element name="timeSliderRail" src="timeSliderRail.png" />
<element name="normalscreenButton" src="normalscreenButton.png" />
<element name="normalscreenButtonOver" src="normalscreenButtonOver.png" />
<element name="unmuteButton" src="unmuteButton.png" />
<element name="unmuteButtonOver" src="unmuteButtonOver.png" />
</elements>
</component>
<component name="display">
<settings>
<setting name="bufferinterval" value="250" />
<setting name="bufferrotation" value="90" />
</settings>
<elements>
<element name="background" src="background.png" />
<element name="playIcon" src="playIcon.png" />
<element name="muteIcon" src="muteIcon.png" />
<element name="bufferIcon" src="bufferIcon.png" />
</elements>
</component>
<component name="dock">
<elements>
<element name="button" src="button.png" />
<element name="buttonOver" src="button.png" />
</elements>
</component>
<component name="playlist">
<settings>
<setting name="fontcolor" value="0xEEEEEE" />
<setting name="backgroundcolor" value="0x333333" />
</settings>
<elements>
<element name="item" src="item.png" />
<element name="itemOver" src="itemOver.png" />
<element name="sliderCapBottom" src="sliderCapBottom.png" />
<element name="sliderCapTop" src="sliderCapTop.png" />
<element name="sliderRail" src="sliderRail.png" />
<element name="sliderThumb" src="sliderThumb.png" />
</elements>
</component>
</components>
</skin>
和 html :
<object id="player1" width="300" height="35" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
<param name="flashvars" value="" />
<param name="allowscriptaccess" value="always" />
<param name="src" value="jwplayer/player.swf" />
<embed id="player1" width="300" height="35" type="application/x-shockwave-flash" src="jwplayer/player.swf" flashvars="skins=autostart=true&skin=jwplayer/skins/skin1.zip" allowscriptaccess="always" />
</object>