Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Script doesn’t work in IE

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #32400
    Eclipse
    Member

    Hi all,

    I’m running into a problem. A client of mine wishes a solution to the following problem:

    On this URL there’s a test. Near the bottom of the page there’s a bunch of question marks which should change to percentages according which radio buttons are pressed.

    The test works fine in all other major browsers but not IE, anyone have an idea where to find a solution to this?

    Any help is deeply appreciated, this is the script:

    /**
    * fires when the dom is ready
    *
    */
    $(document).ready(function() {
    doTest();
    });

    /**
    * does realtime testing
    *
    */
    function doTest() {
    if ( !$('ul.test').length )
    return false;

    var size = $('ul.test li').length - 1;
    var q = 100 / size;

    // check scores
    $('ul.test').click( function(i, e) {

    // reset scores
    var a = 0;
    var b = 0;
    var c = 0;

    $('ul.test input:checked').each( function(i, e) {
    var value = $(e).val();

    if ( value == 1 )
    a++;
    if ( value == 2 )
    b++;
    if ( value == 3 )
    c++;
    });

    // set scores
    $('ul.test span.score').each( function(i, e) {
    if (i == 0)
    t = a;
    if (i == 1)
    t = b;
    if (i == 2)
    t = c;

    $(e).html( Math.round(q * t) + ' %');
    });

    });
    }
    #50106
    Eclipse
    Member

    Anyone got some pointers? I’m quite desperate ;-)
    Never encountered something like this before.

    #50066
    Eclipse
    Member

    I solved it myself! ;D

    There were form-tags missing in the html and after adding them it worked just fine.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.