JavaScript Reference/Javascript Properties/loop

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

"loop" Example

   <source lang="javascript">
   

<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>


     </source>
   
  


"loop" is applied to

   <source lang="javascript">

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

     </source>
   
  


"loop" Syntax and Note

   <source lang="javascript">

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


     </source>