RTL Confirm and Alert in Javascript
Can you开发者_运维知识库 make a confirm
or alert
show its message RTL and right-aligned?
Try adding this at the beginning of your message: "\u200f\u200f"
for example:
alert("\u200f\u200f"+ message);
or
confirm("\u200f\u200f"+ message);
Programmatically no, but the user's culture setting for their machine should determine which way it's presented, at least in all current browsers. I'm not aware of a comprehensive "who supports it" list though.
If you have control over the <html>
tag, set direction to RTL like this <html dir="rtl">
You may also do it with javascript as shown below:
document.getElementsByTagName("html")[0].setAttribute("dir","rtl");
精彩评论