Javascript Loop

Discussion in 'Web Design & Coding' started by zalood, Dec 15, 2002.

  1. zalood

    zalood OSNN Addict

    Messages:
    177
    the following code triggered alarmsound (wav):

    function alarmOn() {
    if (alarmTime == curTime) {
    document.all.sound.src = document.clock.alarmSound.value;
    }

    question:
    what code needs to be added to make the sound repeating/looping ... say 10 times ?

    thanks
     
  2. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    somthing like this

    <script language =Javascript>
    var x;


    function alarmOn() {
    if (alarmTime == curTime)
    {
    for ( x = 1; x <= 10; x++ )
    {
    document.all.sound.src = document.clock.alarmSound.value;
    }
    }

    }
    </script>
     
  3. zalood

    zalood OSNN Addict

    Messages:
    177
    thanks m8 . .