现在的位置: 首页 > 综合 > 正文

js符号注意点总结

2018年01月27日 ⁄ 综合 ⁄ 共 453字 ⁄ 字号 评论关闭

        1:引号

         被双引号括起来的对象内部如果也需要用引号括起来,则只能用单引号,如下所示:

        var section=document.createElement("div");

        section.style.cssText="position:absolute; left:200;top:100;border:1px;width:400;height:400;";

        section.innerHTML="<table border='1'><tr><td><input type='button' value='关闭' onclick='alert(this.parent)'></td></tr></table>"

         document.body.insertAdjacentElement("beforeEnd",section);

         如上面红色标注的语句,里面凡是需要引号的元素都被单引号括起来,如果还使用双引号,则程序将无法运行。

抱歉!评论已关闭.