On the W3 tutorial, it shows htis code:
<html>
<body>
<script type="text/javascript">
<!--
document.getElementById("demo").innerHTML=Date();
//-->
</script>
</body>
</html>
Then it says:
The two forward slashes at the end of comment line (//) is the
JavaScript comment symbol. This prevents JavaScript from executing the
–> tag.
This doesn’t make sense to me. I thought the whole thing got commented out.
First of all, W3Schools has nothing to do with W3. Their tutorials were pretty horrible before people started complaining and their confusing name implies that they are somehow connected to W3, but in reality they aren’t.
Second of all, this method is not needed anymore. There are no used browsers that don’t support JS cleanly (
links,lynx, etc. have no troubles with JS code whatsoever).That being said, the code is supposed to do this: