Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Three quotes

Status
Not open for further replies.

minli98

IS-IT--Management
Joined
Aug 30, 2005
Messages
178
Location
US
Hi,

I know we can use both " and ' as quotation marks, but what if I need to have 3 in one line. Can I do that?

For example:
Code:
...
errorCode+="<a href='#' onclick='javascript:document.getElementById(~myDiv~).style.visibility = ~hidden~'>close</a>";

In this example, I use the symbol ~ as my third quotation mark, but of course this example wouldn't work. Is there a symbol I can use as the third quotation mark?

Many thanks.
Regards,
Min
 
You can "escape" quotes you need to appear in something using the \ character:

Code:
errorCode+='<a href="#" onclick="document.getElementById(\'myDiv\').style.visibility=\'hidden\'">close</a>';

Also, the onclick event (as well as other on events) doesn't need the javascript identifier.

Lee
 
Thanks Lee, I will give it a try.

Regards,
Min
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top