8.7w+
社区成员
<html>
<head>
<script type="text/javascript">
<!--
function reload(){
location.replace("http://baidu.com");
}
//-->
</script>
</head>
<body onload="reload()"></body>
</html>
<html>
<head>
<script type="text/javascript">
<!-- function reload(){
location.replace("http://baidu.com");
}
//-->
</script>
</head>
<body onload="reload()"></body>
</html>
<!-- function reload(){
location.replace("http://baidu.com");
}
//-->
是有这种注释的用法的,现在两个代码的区别是下面代码多个换行符。。。<html>
<head>
<script type="text/javascript">
alert('this line before HTML comment');<!--
<!-- alert('ignore this line');
alert('this line valid');
-->
</script>
</head>
</html>