Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2002
    Posts
    304

    Question Passing a "]" in function parameters...

    How do i pass the special characters [ and ] in a javascript function's parameters?

    Heres the code I have currently that doesnt work:

    PHP Code:
    onKeyDown="limitText(this.form.email[body],this.form.countdown,100);"  
    onKeyUp="limitText(this.form.email[body],this.form.countdown,100);" 
    Gaming Forums: NecroTalk.com | DeathKnightArmy.com NEW!

  2. #2
    Join Date
    Mar 2006
    Posts
    965
    I might not be the best specialist in JS but:

    have you tried changing:

    PHP Code:
    onKeyDown="limitText(this.form.email[body],this.form.countdown,100);"   
    onKeyUp="limitText(this.form.email[body],this.form.countdown,100);" 
    to:

    PHP Code:
    onKeyDown="limitText(this.form.email["body"],this.form.countdown,100);"   
    onKeyUp="limitText(this.form.email["body"],this.form.countdown,100);" 
    ?

    It might not work but, when I take a look at some of my JS samples I have, it pretty much looks like this under the JS functions.

  3. #3
    Use single quotes arround array indexes.

Posting Permissions

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