开发者

JSLint "document.write can be a form of eval" - How is this so?

开发者 https://www.devze.com 2023-02-21 00:26 出处:网络
I\'ve come across this message in JSLint... document.write can be a form of eval. and was wondering exactly how so?

I've come across this message in JSLint...

document.write can be a form of eval.

and was wondering exactly how so?

The JSLint instructions page states:

The eval function...provide access to the JavaScript compiler. This is sometimes neces开发者_如何学编程sary, but in most cases it indicates the presence of extremely bad coding....

So, how does document.write "provide access to the JavaScript compiler" then?

Thanks


What does your browser do with this?

document.write('<script type="text/javascript">window.alert("evaled " + (1 + 2))</script>');
0

精彩评论

暂无评论...
验证码 换一张
取 消