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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Special characters within alert() method

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want to put a non-English message into an alert box. How do you specify accented characters like these: é, à, î ?
 
Simple same as anywhere in a web page.

ie. alert(" Votre chiffre préféré est le 2")


Have Fun...

Sharky99 >:):O>
 
I think you need the special font in order to have the message like that, but basicaly SHARKY99 is correct...
:) I have not failed; I merely found 100,000 different ways of not succeding...
 
ok, thanks but i tried this. but doesn't show up properly in IE5 on Mac. any other suggestions?
 
Ok thanks again. but I tried special character codes too. That's a handy site you mentioned. But I believe the problem is that the alert message must exist withing double quotes so it then interprets the code literally. So with the special character codes is displays them in the message instead of the accented character. I'm ready to assume its a limitation of the alert() method.
 
If it is a static message you want to display, you could try something like this:

var strMessage = "Here is the special character: " + String.fromCharCode(--Unicode number here--)
alert(strMessage)


DevGuru has a good example/explanation of the String.fromCharCode() method.
 
This is a really good suggestion and it works for basic letters. ie: String.fromCharCode(65,66,67) returns 'CAB' in an alert box.

I'm just trying to figure out which Unicode and how to use it.
Thanks tremendously for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top