有没有什么好的理由让javascript成为内联 [英] Is there any good reason for javascript to be inline

查看:67
本文介绍了有没有什么好的理由让javascript成为内联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在建网站。在某些阶段,我注意到IE显示有点坏了,Chrome除了身体标签(空)之外什么都没有呈现,而且FF看起来都很好。

I've been building a site. At some stage I noticed that IE display was a little broken and Chrome had all but rendered nothing but the body tag (empty), and FF all looked good.

投掷之后我的键盘在房间里,我的头靠在我的鼠标上,我发现了问题。我已离开(不要问如何或为什么,一定是闪电般的速度切割和粘贴错误)在内联脚本块中未公开的HTML注释。

After throwing my keyboard around the room and bashing my head against my mouse, I discovered the problem. I had left (don't ask how or why, must have been some lightning speed cut and paste error) an HTML comment unclosed in an inline script block.

<script type="text/javascript">
        <!--
        ...
    </script>

我猜测(未经测试)问题不会出现,或表现在如果脚本是外部的,则更加明显。所以无论如何,我想,有没有时间你有一个很好的理由来编写内联脚本?

I'm guessing (not tested) the problem would have either not come up, or manifested itself in a far more noticeable way if the script was external. So anyways, I got to thinking, is there ever a time when you have a really good reason to write inline script??

推荐答案

无。写下不引人注目的Javascript

这篇关于有没有什么好的理由让javascript成为内联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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