Forum Moderators: open

Message Too Old, No Replies

Using Symbols in JavaScript Alerts

         

Jeremy_H

2:50 am on Jul 19, 2006 (gmt 0)

10+ Year Member



I would like to have a javascript alert contain the copyright symbol, but I'm running into troubles with this.

For reference, my page is encoded with a utf-8 chartype.

I have tried:

alert("© Copyright-Holder Copyright-Years");

and

alert("© Copyright-Holder Copyright-Years");

And neither seemed to work.

For consistency, I would like to use the circle C, but short of this I would use things like (c) or Copyright, but again, I would like for a sense of consistency.

Does anybody know if I can have special characters in my JavaScript?

Thanks

adni18

3:05 am on Jul 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this:

alert(unescape("%C2%A9")+" Copyright-Holder Copyright-Years");

Jeremy_H

4:07 am on Jul 19, 2006 (gmt 0)

10+ Year Member



Thank you very much.

I'm guessing WW might have changed some of the script posted (like how to breaks bars ¦ automatically).

But % A 9 works great (without the spaces). Thanks so much!

adni18

9:50 pm on Jul 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm guessing WW might have changed some of the script posted (like how to breaks bars ¦ automatically).

Really? That's odd... usually the only thing WW does is the ¦ breaking and removing a space before a question mark. It shouldn't have changed any of the code I posted....

Oh well. You're welcome! :)