JavaScript Reference/Javascript Properties/loop

Материал из Web эксперт
Перейти к: навигация, поиск

"loop" Example

    
<html>
<body>
<bgsound id="myBgS" src="yourmusic.wav" loop="1">
<script language="JavaScript">
    function function1() {
        document.all.myBgS.loop = 2;
    }
</script>
<input type="button" value="Set the loop value to 2" onClick="function1();">
</body>
</html>



"loop" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<bgsound>                       <img>                         |
|                |<input>                         <input type="image">          |
|                |<marquee>                                                     |
+----------------+--------------------------------------------------------------+



"loop" Syntax and Note

Note:
Read and write property. 
Sets the number of times the object will loop. 
For the <marquee> element,            a value of 0 or -1 (the default) 
                                      will cause the element to loop indefinitely. 
-----------------------------------------------------------------------------------
For the <bgsound>,                    a value of 0 will cause the element to loop once,
<img>, <input>, and                   and a value of -1 will cause it to loop indefinitely
<image> elements,                     (the default value is 1).
    
Syntax:
    
document.all.elementID.loop = value