4

How to show java script alert of arabic characters/text from ltr(Left to right) format.In html we have ltr tag.

bhardwaj
  • 41
  • 1
  • 2

3 Answers3

1

This is largely operating system dependent. Simply reversing the string is not 100% correct, since this does not render punctuation correctly.

If you need 100% locale independence in the browser, I would suggest using an HTML dialog, like jQuery UI, instead of alert().

spoulson
  • 21,335
  • 15
  • 77
  • 102
0

You can't do it using the regular javascript alert()

however, you can use some custom javascript alert box (you can use HTML inside it)

some like this http://slayeroffice.com/code/custom_alert/ or http://jdstiles.com/java/jsalert.html

Aziz
  • 20,065
  • 8
  • 63
  • 69
0

Hi, this is possible using unicode control characters:
- variable 'g' without ucc

var g="أكتب تعليقا!\nWrite a comment!\n";
  • variable 'g' with ucc
var g="‫أكتب تعليقا!\n‪Write a comment!\n";

or

var g="‫أكتب تعليقا!\n‪Write a comment!\n";

simply: place (LRE) character (‪‪‪) in multi-dir texts where embedded texts start from left-to-right; place (RLE) character (‫) in multi-dir texts where embedded texts start from right-to-left.

or on your win notepad right click where embedded text start, insert unicode..., (LRE) or (RLE)