简单的html vs Javascript生成的html? [英] Simple html vs Javascript generated html?

查看:118
本文介绍了简单的html vs Javascript生成的html?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的Web应用程序中,我希望避免使用html,只使用javascript来创建网页的dom树。方式在html < div>一些文本< / div> 或使用javascript dom渲染,像这样: div.appendChild(document.createTextNode(一些文本));

解决方案

坚持使用传统的HTML。它不仅比使用javascript做的更快,更加可维护。



除非有令人信服的原因,否则请坚持使用直接的HTML,并使用JavaScript来实现更多互动的应用程序。


In my web application I would like to complately avoid html and use only javascript to create web-page's dom tree.

What is faster writing web content in the traditional way in html <div>Some text</div> or using javascript dom render, like this: div.appendChild(document.createTextNode("Some text"));?

解决方案

Stick with the traditional HTML. It's not only faster than doing everything with javascript, it's much more maintainable.

Unless there is a compelling reason otherwise, stick with the straight up HTML and use javascript for the more interactive pieces of your app.

这篇关于简单的html vs Javascript生成的html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆