Ampersands in String Constants

    Do not forget, dear javascript programmers, to indicate ampersands as "&" in string constants, and not just as "&". For otherwise the results will be very browser-dependent:
    document.body.innerHTML = "http://example.org/get.php?test";
    document.body.innerHTML + = "& ok";
    document.body.innerHTML + = "& wonderful";
    Result:
    Firefox:http://example.org/get.php?test&ok&wonderful
    Chrome:http://example.org/get.php?test&wonderful
    IE:http://example.org/get.php?test

    Also popular now: