Reply
Passing a "]" in function parameters...
Old 09-16-2006, 04:56 PM Passing a "]" in function parameters...
nocturnix's Avatar
Novice Talker

Posts: 14
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);" 
nocturnix is offline
Reply With Quote
View Public Profile Visit nocturnix's homepage!
 
When You Register, These Ads Go Away!
Old 09-16-2006, 05:21 PM Re: Passing a "]" in function parameters...
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
Wireless Audio
Posts: 2,322
Name: Keith Marshall
Location: West Hartford, CT
Using [ and ] is referencing an array key. If you are wanting to pass it as a literal characture, you need to quote it. "[" "]"
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 09-16-2006, 05:52 PM Re: Passing a "]" in function parameters...
nocturnix's Avatar
Novice Talker

Posts: 14
Dang, I tried that and it didnt work
nocturnix is offline
Reply With Quote
View Public Profile Visit nocturnix's homepage!
 
Old 09-17-2006, 03:36 AM Re: Passing a "]" in function parameters...
Ultra Talker

Posts: 253
Location: Auckland, New Zealand
You need to quote inside it, obviously what you're doing is accessing a property of email called body, so the correct way would be:

Code:
onkeydown="limitText(this.form.email['body'],this.form.countdown,100);"
onkeyup="limitText(this.form.email['body'],this.form.countdown,100);"
If that does not work, then body is not a property of email.

Cheers,

MC
__________________
#------------------------------signature---------------------------------------------------------------------------------#
Quote:
I am well recognised for what I don't do than what I do. Chores are just one of those things.
mastercomputers is offline
Reply With Quote
View Public Profile Visit mastercomputers's homepage!
 
Reply     « Reply to Passing a "]" in function parameters...
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.18829 seconds with 12 queries