0

I have two div tags in my html code as shown below. I want to change their float property depending on page UI culture ( Ui culture is en-US or fa-IR) ... I think I can use java script to do so. but I don't know how can I get the UI Culture through Javascript. I want a code in if condition to determine the Ui culture ... thx in advance for your help...

<div id="zone1" style="float: left;"><img alt="" src="~/IconArrow.png" /> &nbsp;</div>
<div id="zone2" style="float: left;"><img alt="" src="~/IconHome.png" /></div>

<script type="text/javascript">
if(/* ui culture is fa-IR*/)
{
    document.getElementById("zone1").style.float = "right";
    document.getElementById("zone2").style.float = "right";     
} 
</script>
Pratyusha Terli
  • 2,343
  • 19
  • 31
mjyazdani
  • 2,110
  • 6
  • 33
  • 64
  • Here is a link to similar question: [http://stackoverflow.com/questions/2678230/how-to-getting-browser-current-locale-preference-using-javascript][1] Hope that helps. [1]: http://stackoverflow.com/questions/2678230/how-to-getting-browser-current-locale-preference-using-javascript – hyde Nov 19 '12 at 09:33

1 Answers1

0

Hello try this and let me know. if this solves your problem please don't forget to select correct answer

<script type="text/javascript">
function testfunc(g)
{
    //alert("asd"+g);
    if(g == "fa-IR")
    {
        alert("as");
        obj = document.getElementById("zone1");
        obj2 =document.getElementById("zone2");
        obj.setAttribute("style", obj.getAttribute("style") + "; float:right; ");
        obj2.setAttribute("style", obj2.getAttribute("style") + "; float:right; ");
    }
}
</script>

=================================================================================

<div style="display:block; width:100%; height:100px; border:1px solid #333">
    <div id="zone1" style=" float: left; display:block; width:20px; height:20px; background:#93F;"> </div>
    <div id="zone2" style="  float: left; display:block; width:20px; height:20px; background:#F66;"> </div>
</div>

<input type="button" name="" onclick = "testfunc('fa-IR')" value="test" />
Parag
  • 4,754
  • 9
  • 33
  • 50