Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: timers don't work in IE8

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default timers don't work in IE8

    My timers do not work in IE8. IF anyone could offer some assistance as to why, it would be appreciated.



    <script>
    var timers = {};
    var load = function(){
    var update = function(){
    $('input.timedown').each(function(){
    var T = $(this);
    var id = T.attr('id');
    var time = T.val().split(':');
    time = (time[0] * 60) + time[1];
    timers[id] = {
    max: parseInt(time, 10),
    current: 0,
    time: T,
    timeup: $('#'+id+'C'),
    start: $('#'+id+'S'),
    reset: $('#'+id+'R')
    };
    });
    console.log(timers);
    };
    update();

    $('input.timedown').on('change', update);

    $('input[value="Start"]').on('click', function(){
    var T = $(this);
    var name = T.attr('name');
    timers[name].on = true;
    timers[name].reset.attr('disabled', false);
    T.attr('disabled', true);
    });

    $('input[value="Reset"]').on('click', function(){
    var T = $(this);
    var name = T.attr('name');
    timers[name].on = false;
    timers[name].timeup.val('');
    timers[name].current = 0;
    timers[name].start.attr('disabled', false);
    T.attr('disabled', true);
    });

    setInterval(function(){
    $.each(timers, function(i){
    if(this.on) {
    this.timeup.val(this.current++);
    if(this.current > this.max) {
    alert('Time up!');
    this.on = false;
    this.current = 0;
    }
    }
    });
    }, 1000);

    };
    $(load);
    </script>


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: timers don't work in IE8

    JavaScript is not Java.

Similar Threads

  1. defaultCloseOperation doesn't work plus JButttons don't show up
    By Gugubo in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 27th, 2013, 05:42 AM
  2. Replies: 1
    Last Post: September 9th, 2013, 11:26 AM
  3. Logical operators don't seem to work in a very basic class
    By hairLess in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 23rd, 2012, 03:25 PM
  4. Printing different text each second (Timers etc)
    By 3dAndersson in forum Object Oriented Programming
    Replies: 2
    Last Post: April 25th, 2012, 09:30 AM
  5. Swing Timers
    By Sterzerkmode in forum AWT / Java Swing
    Replies: 5
    Last Post: November 10th, 2009, 09:10 PM

Tags for this Thread