Results 1 to 4 of 4

Thread: SOS: Form SelectedIndex autochange script

  1. #1
    Join Date
    Oct 2007
    Posts
    37
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Talking SOS: Form SelectedIndex autochange script

    Hi,
    im actually not an js coder, so i spent a few hours to find script i need but looks like there are no such script
    i currently use this stuff -
    http://www.w3schools.com/php/php_ajax_database.asp
    so what i need is to make that fields in the box go automatically from first to the last then first again and so on until i choose some field manually.
    i tried things like this
    Code:
    function roller() {
    for (i=0;i<3;i++) { setTimeout("roll(i)", 3000) }
    }
    function roll(i) { document.usersform.users[i].selected = "1" }
    but it jumps to last field and do not show any of previuos fields. and its do not affect mysql select action so nothing is really happens.
    so, is there are any chances to expand that script this way?
    thanks in advance
    Last edited by Samuell; 02-14-2008 at 04:23 PM.

  2. #2
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    your setting all three checkboxes to be checked at the same time. try this:
    Note: If edited incorrectly, this script will cause the browser to stop responding, force the user to end the browser by force, and cause many people to get angry.
    Code:
    function roller() {
    var total=3;//number of options
     for (var i=0;i<total;i++) { 
      setTimeout("roll("+i+")", (3000*(i+1)));
     }
     setTimeout("roller()", (3000*total));
    }
    function roll(i) { 
     document.usersform.users[i].selected = "1";
    }
    Last edited by Master_script_maker; 02-14-2008 at 08:49 PM.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  3. #3
    Join Date
    Oct 2007
    Posts
    37
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    yea, thanks, its rolls now, but its still not affect function inside onchange event of the form, so nothing is happens, its strange couse i thought it should affect
    and i have no idea how to stop this rolling

    any ideas?

  4. #4
    Join Date
    Oct 2007
    Posts
    37
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    ok, i find out why onchange handler of the form do not react on SelectedIndex change - its just can't be trigered this way, so i'm trying to use
    Code:
    document.usersform.users[i].fireEvent("onchange")
    instead of
    Code:
    document.usersform.users[i].selected = "1";
    but its still don't work and couse an error, so
    what is wrong now and how i can make it work?
    please, anybody!
    Last edited by Samuell; 02-17-2008 at 08:25 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •