客户端组成|创建元素与.innerHTML写入|隐形代码 [英] Client Side Composing | Create Elements vs. .innerHTML writes | invisible code

查看:79
本文介绍了客户端组成|创建元素与.innerHTML写入|隐形代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个更好?



有没有一种方法可以将内容保留在view-> source()?

解决方案

我认为他们反对的是使用innerHTML。有人会说,构建和添加节点( http://www.w3schools.com/dom/dom_nodes_add。 asp )将是更精确的方式来做到这一点,你至少应该把它看作一个选项。如果工作量太大,我只能说用innerHTML。无论如何,它几乎支持任何浏览器。 ( http://www.quirksmode.org/dom/w3c_html.html ) p>

Which is better?

Is there a way to keep content out of the view->source()?

解决方案

I think what they objected to was the use off innerHTML. Some would say that constructing and adding nodes (http://www.w3schools.com/dom/dom_nodes_add.asp) would be the more refined way to do this and you should at least look at it as an option. If it's too much work, I say just go with innerHTML. It's supported by pretty much any browser anyway. (http://www.quirksmode.org/dom/w3c_html.html)

这篇关于客户端组成|创建元素与.innerHTML写入|隐形代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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