September 15, 2010

Print Special Characters like the Copyright Symbol using JavaScript




To print special characters like the Copyright symbol © or a Trademark ™ using JavaScript, use escape sequences.

For example, to print the Copyright symbol ©, use this code:

<html xmlns="http://www.w3.org/1999/xhtml" >
<
head>
<
title>Print Special Characters using JavaScript</title>
</
head>
<
body>
<
div id="divOne" />
<
script type="text/javascript">
var
str = "Copyright \u00A9 DevCurry.com";
document.getElementById('divOne').innerHTML = str;
</script>
</
body>
</
html>

Check some more Character Entity References over here. Note that escape sequences in JavaScript begins with a backslash character (\) like \u00A9 and so on.

OUTPUT

image



'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

1 Response to "Print Special Characters like the Copyright Symbol using JavaScript"
  1. Beben said...
    September 16, 2010 4:21 AM

    hihihi
    thanks a lot my friend ^^

 

Copyright © 2009-2012 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions