Sets or retrieves the number of times a sound or video clip will loop when activated.
dhtml语法
HTML | <ELEMENT LOOP
= iLoop... >
|
---|
Scripting | object.loop [ = iLoop ] |
---|
DHTML可能的值
iLoop | Variant that
specifies or receives one of the following values.-1 | Loops infinitely. | 0 | Loops one time. | count | Number of times to loop. |
|
The property is read/write.
The property has a default value of
1.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.
remarks
to restart a sound or video clip after changing its loop property, set the src property or dynsrc property to itself. for example:
oBGSound.src = oBGSound.src
In Microsoft® Internet Explorer 4.0, when you restart a video by changing its loop property, the video opens and plays in a new window.
The following are descriptions of how the loop property works for some boundary cases.
<BGSOUND src="file:///c:\win95\system\msremind.wav"> | Loops one time |
<BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP> | Loops one time. |
<BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=> | Loops one time. |
<BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=0> | Loops one time. |
<BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=-1> | Loops infinitely. |
DHTML代码范例
This example uses the loop property and the src property to change the number of times a background sound loops.
<SCRIPT>
function loopOnce() {
oBGSound.loop = 1;
oBGSound.src = oBGSound.src; // reload sound
}
function loopContinuously() {
oBGSound.loop = -1;
oBGSound.src = oBGSound.src; // reload sound
}
</SCRIPT>
:
<BGSOUND id="oBGSound" src="sound.wav">
<BUTTON onclick="loopOnce()">Loop Sound Once</BUTTON>
<BUTTON onclick="loopContinuously()">Loop Sound Continuously</BUTTON>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
是否符合公共标准
There is no public standard that applies to this property.
Applies To