Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 16
Trades: 0
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!
 
 
Register now for full access!
Old 09-16-2006, 06:21 PM Re: Passing a "]" in function parameters...
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
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, 06:52 PM Re: Passing a "]" in function parameters...
nocturnix's Avatar
Average Talker

Posts: 16
Trades: 0
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, 04:36 AM Re: Passing a "]" in function parameters...
Ultra Talker

Posts: 256
Location: Auckland, New Zealand
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.66490 seconds with 12 queries