沫沫金:JavaScript拼接html片段使用反斜杠

JS使用“\”反斜杠拼接

$('#result_ok').append('<p>\
                    预约挂号医院:西安市第八医院\
                    </p>\
                    <p>\
                        预约挂号科室:皮肤科-1科室 皮肤科\
                    </p>\
                    <p>\
                        预约挂号医生:<label>皮肤科-医生001</label> \
                    </p>\
                    <p>\
                        预约医生级别:<label>名老专家</label> \
                    </p>\
                    <p>\
                        诊金及挂号费:\
                        <label>\
                            100\
                        </label>\
                        元\
                    </p>\
                    <p>\
                        预约就诊时间:\
                        <label>\
                            2015-05-25\
                        </label>\
                        <label>\
                            上午 8:00~12:00\
                        </label>\
                    </p>');

可以正常运行 相当于str+="<p>",每一行都必须str+=这个固定格式,必须简化掉(懒啊)


沫沫金,2015年倒数第二天纪念发文(庆祝二零一六开年



你可能感兴趣的:(沫沫金:JavaScript拼接html片段使用反斜杠)