Javascript also supports Conditional compilation (whether it is an interpreted or compiled language ). <HTML>
<Body>
<SCRIPT type = "text/JavaScript">
/** // * @ Cc_on
Document. Write ("jscript version:" + @ _ jscript_version + ". <br> ");
/* @ If (@ _ jscript_version> = 5)
Document. Write ("jscript version 5.0 +. <br \/> ");
Document. Write ("You can see the text only when the browser supports jscript5 +. <br> ");
@ Else @*/
Document. Write ("You can see this line of text when using other browsers (such as Firefox, ie 4.x) <br> ");
/** // * @ End
@*/
</SCRIPT>
</Body>
</Html>
After running, My IE will display the three lines in the comment:
JScript version: 5.6.
JScript version 5.0 +.
Only when the browser supports jscript5 + can you see the text.
However, I can't figure out what it will do for me for a long time: Because I write Webpage Programs on the enterprise intranet, the user knows that they all run on Win2k or WINXP, my code never checks whether the browser is IE or nescape. Secondly, when I write a winform program, it is basically not compiled using conditions.
It is only a record. It will be used later.
More introduction on this page: http://sheneyan.com/tech/article/js/conditionalcompile.html