javascript alert in japanese

Discussion in 'JavaScript' started by gabs, Jul 11, 2006.

  1. #1
    Hi,

    I'm using shift js for all my web conent but the javascript alert comeout with all the code e.g. &1234;

    Has anyone done this before.. The page contents in perfect..

    :D
     
    gabs, Jul 11, 2006 IP
  2. giraph

    giraph Guest

    Messages:
    484
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #2
    HTML is what encodes things like &amp; not javascript. What you could do, I'm not sure if there's an easier way is to do a replace, like replace &amp; with & and such. Here is an example of code that would replace &lt; with < and &gt; with >

    
    var h = "&lt;code&gt;"
    alert(h);
    h = h.replace(/&lt;/g,"<");
    h = h.replace(/&gt;/g,">");
    alert(h);
    
    Code (markup):
     
    giraph, Jul 11, 2006 IP