The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Sets or retrieves the number of times a sound or video clip will loop when activated.
Syntax
| HTML | <element loop="loop" ... > |
|---|---|
| JavaScript | |
Property values
Type: Variant
-1
-
Loops infinitely.
0
-
Loops one time.
count
-
Number of times to loop.
Value Condition 1 Default. Loops once.
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
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. |
Examples
This example uses the loop property and the src property to change the number of times a background sound loops.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/loop.htm
<script type="text/javascript">
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>
See also
Send comments about this topic to Microsoft
Build date: 11/28/2012