简体   繁体   中英

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.

<!--[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] --> . 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 .

So you can put that conditional comment at the bottom in your body element.

Yes. Conditional comments do not have to be in the head tag.

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

You can put that code in the <head> tag and it will work.

But it can go anywhere.

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

Could this work?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM