How to change css style by using Unicode Hexadecimal

Tags: javascript,html,css,unicode,escaping

Problem :

Here is my code:

document.body.innerHTML="<p style=font-family:\22arial\22>hello</p>";

\22 should be “ , however, the result page turns out to totally ignore them:

enter image description here

But whats interesting is that if i used HTML Entity Name "&quot;" :

    document.body.innerHTML="<p style=font-family:&quot;arial&quot;>hello</p>";

after I used entity name the result page is exactly what I want Is it something related to the encoding / decoding method my browser use?

Solution :

If you're talking about unicode characters, the notation should be '\u0022'. That one works for me when I test it:

alert("He said: \u0022Hello, World!\u0022");

But for a quote, you could also use a backslash to escape the quote character itself:

alert("He said: \"Hello, World!\"");

or use a single quoted string:

alert('He said: "Hello, World!"');

    CSS Howto..

    how to keep the css style after inserting a row to table by jquery

    How do I spilt the footer into different widths?

    How to adjust height based on content css

    Bootstrap 3: How to make margins responsive?

    How do i use floats for images while using
    so that
    still shows under image?

    How to stretch a div to the viewport bottom without using absolute positioning?

    How is possible to get 2d transformation css vertical way

    How do I combine two columns with different formatting?

    How to Vertically Center Images on a Line?

    How to float

    to bottom of a

    when you can't use position:relative and position:absolute

    How to put a border around the text in a button?

    How would you code this: Grid-breaking shapes

    how can I position my img right?

    How do I make background-size work in IE8?

    How to relativize URLs in css files in Hakyll?

    How to Inject external css style sheet into GWT Panel widget?

    How can i auto rotate this carousel

    How can I use Javascript to allow navigation between sections using keyboard shortcuts?

    How do I set a block of text to drop to a new line all at once?

    How to do navbar fixed?

    How can I Highlight links only in Blog Posts with Mouseover?

    How to prevent the backdrop of bootstrap modal dialog from covering the whole screen?

    How can I shift up a div and all divs that follow it?

    How to rotate an element around a line other than X=0,Y=0 and Z=0 using CSS3?

    Setting a revealing onhover behaviour for multiple elements-pairs with only CSS - how come this works?

    How do I style a circular vertically-loading progress bar?

    how to interactively toggle CSS sheets(s) on a webpage for testing/learning purposes?

    How to make comment shape using css

    How would I make this into an dynamic :nth-child css selector [duplicate]

    How to add jQuery function to hover (show) and then click to show another menu