Skip to main content
Participating Frequently
November 22, 2006
Answered

Ampersand in context menu problem

  • November 22, 2006
  • 2 replies
  • 692 views
Is there anyway to get the ampersand to show in the context menu. It's a simple string and I don't understand why it sees the ampersand as code instead of text. I've attached the affected code. Please help a newbie out!
Thanks!
JK
This topic has been closed for replies.
Correct answer Newsgroup_User
If the caption contains an ampersand, the character following the ampersand
is underlined to indicate a keyboard mnemonic.

Use two ampersands: "&&".


2 replies

clbeech
Inspiring
November 22, 2006
Sure. There are several reasons why it may not be reading. the Ampersand is a special character (one of several) and often does not get interpreted as a 'string' character.

First, is this a dynamic text field? If so, you may need to embed the special character set which includes the ampersand.

Second (and first method to try), you may be able to 'escape' the character by preceeding it in your string using the ' \ ' or backslash just before the & ...

"©2006 Name \& Name" ... like so.

if that doesn't work then you need to describe the character using the ASCII code and adding the "fromCharCode()" command as in ...

"©2006 Name " +String.fromCharCode(38)+ " Name"

you use the ACSII number for whatever character you want within the (). '38' happens to be the code for an ampersand.

hope this helps.
Newsgroup_UserCorrect answer
Inspiring
November 22, 2006
If the caption contains an ampersand, the character following the ampersand
is underlined to indicate a keyboard mnemonic.

Use two ampersands: "&&".


JK HudsonAuthor
Participating Frequently
November 27, 2006
Use two ampersands: "&&".

Simple and effective. Thanks!