Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    seb
    seb is offline
    New to the CF scene
    Join Date
    Dec 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How fast can javascript be?

    I'm currently working on a site that might require the populating of a dropdown, to the tune of 2000 entries or so. I might also try to add functionality where the contents of the <select> change as a user types, so they can narrow the list down.

    Is it possible to make this sort of thing execute at an acceptable speed? My current tests say "no" but I know my code is far from the best - should I bother persevering or just give up?

    cheers

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Instead of changing the options in the select element, why not try to use the TypeAheadCombo class I made, based on a bunch of stuff written by this board's own illustrious glenngv?

    It's easy to implement, and it'll work on any select element, whether created in the HTML of a page or by scripting.

  • #3
    seb
    seb is offline
    New to the CF scene
    Join Date
    Dec 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Very interesting chooper, I guess I should have guessed someone would have done this before

  • #4
    Super Moderator sage45's Avatar
    Join Date
    May 2002
    Posts
    1,060
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Oh I see... Glenngv is the only illustrious person here huh... ... But but but what about me...

    Nice code, btw...

    -sage-
    HTML & CSS Forum Moderator

    "If you don't know what you think you know, then what do you know."
    R.I.P. Derrick Thomas #58
    1/1/1967 - 2/8/2000

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    seb put your code in a .js file or in several e.g. one for your code and another for oyur dropdown options.

    this will enable the script to be cached by the users browser.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #6
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Rendering is slow. If you must populate HTML elements on the fly with lots of children, either create a new replacement in memory, then replaceChild() when it is populated, or maybe try setting display to "none" before populating, populate, then change it back to "block" or whatever.


  •  

    Posting Permissions

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