0

Currently im doing like this but internet explorer 7 doesn't recognize it:

    gf.klass["LoginSkin"] = ""+<r><![CDATA[<div>
        <ul>
            <li value="login" >
                login
            </li>
            <li value="cancel">
                cancel
            </li>
        </ul>
    </div>]]></r>;;
1
  • 1
    What you are trying to do doesn't really make sense. Mozilla based browsers support something like this with E4X ( developer.mozilla.org/en/E4X ), but if you want something general you'll need to go in more detail and explain what you are trying to achieve. Commented Dec 19, 2010 at 22:25

2 Answers 2

1

The syntax you've quoted is invalid JavaScript. The valid equivalent would be:

gf.klass["LoginSkin"] = '<div>\
    <ul>\
        <li value="login" >\
            login\
        </li>\
        <li value="cancel">\
            cancel\
        </li>\
    </ul>\
</div>';

Note the use of the trailing backslash to continue the literal to the next line. This is per Section 7.8.4 ("String Literals") of the spec.

Note that the leading characters of subsequent lines are part of the string (just as they are in your CDATA section).

Sign up to request clarification or add additional context in comments.

Comments

0

you have element.innerHTML method to retrieve HTML of subelements !

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.