loop attribute | loop property

Information
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.
4 out of 5 rated this helpful - Rate this topic

Sets or retrieves the number of times a sound or video clip will loop when activated.

Syntax

HTML<element loop="loop" ... >
JavaScript

loop = object.loop

Property values

Type: Variant

-1

Loops infinitely.

0

Loops one time.

count

Number of times to loop.

ValueCondition
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

bgSound
img
input
input type=image

 

 

Send comments about this topic to Microsoft

Build date: 11/28/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

© 2013 Microsoft. All rights reserved.