简体   繁体   English

我们可以在之前的IE条件评论中添加javascript </body>

[英]Can we add javascript in IE conditional comment just before </body>

This code should i place this code at bottom of body it's in conditional comment. 我应该将此代码放在body的底部,这是条件注释。

<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta2)/IE7.js"></script>
<![endif]-->

Conditional comments use the syntax of normal comments: <!-- [if …]>…<![endif] --> . 条件注释使用普通注释的语法: <!-- [if …]>…<![endif] --> That's why browsers that don't understand them ignore them. 这就是为什么不理解它们的浏览器会忽略它们。 So they can be put wherever normal comments are allowed. 所以它们可以放在允许正常注释的地方。 And the script element is allowed to be child of the body element . 并且允许script元素body元素的元素

So you can put that conditional comment at the bottom in your body element. 因此,您可以将该条件注释放在body元素的底部。

Yes. 是。 Conditional comments do not have to be in the head tag. 条件注释不必位于head标记中。

http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx

You can put that code in the <head> tag and it will work. 您可以将该代码放在<head>标记中,它将起作用。

But it can go anywhere. 但它可以去任何地方。

       <!--[if lte Gecko 3.1]><script type="text/javascript">    
Cufon.replace('.cufonised p, H2');
    </script>  <![endif]-->

Could this work? 这可行吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IF IE中的条件评论? - IF IE conditional comment in JavaScript? <head>中的JavaScript或</ body>之前的JavaScript? - JavaScript in <head> or just before </body>? IE 8的条件注释不起作用 - Conditional comment for IE 8 not working 如何在innerHTML中嵌入IE的条件注释? - How can I embed a conditional comment for IE with innerHTML? 我们如何向其中包含的所有<a>标签</a>添加下载属性 <body></body> 标签(使用JavaScript)? - How can we add a download attribute to all the <a> tags present inside <body></body> tag (using JavaScript)? 我可以在页面标题中添加JavaScript,以将所有其他脚本移到结束body标签之前吗? - Can I have a JavaScript in the header of a page that moves all other scripts just before the closing body tag? 是否有必要在JavaScript中具有原型继承,以便我们可以动态传播添加的新属性? - Is it necessary to have prototypal inheritance in JavaScript just so we can dynamically propagate new properties we add? “IE8除外”的条件评论? - Conditional comment for 'Except IE8'? 在Django中删除注释之前,我们如何生成构想提示? - How can we generate a conformation prompt before deleting a comment in Django? 使用 javascript 向 html 正文添加评论和回复按钮 - add comment and reply button to html body using javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM