JavaScript 注释的使用技巧

 时间:2026-02-16 15:54:10

1、最简单的代码形式。

// ******:就是最简单的JAVA代码注释语句。这样的语句不会在网页上呈现出来。

JavaScript 注释的使用技巧

2、一个完整的使用JAVA注释 的文本程序案例。

<html>

<body>

<script type="text/javascript">

// 我这里写标题:

document.write("<h1>我的标题</h1>");

// 我这里写段落:

document.write("我的段落一。");

document.write("我的段落二。");

</script>

</body>

</html>

JavaScript 注释的使用技巧

3、JAVA的多行注释使用技巧。/*  */ 这个中间的注释不限定具体的行数。

JavaScript 注释的使用技巧

4、一个多行注释的使用效果呈现。

<html>

<body>

<script type="text/javascript">

/*

这是多行代码注释

这句话不会展示出来

*/

document.write("<h1>百度经验</h1>");

document.write("越写越棒");

document.write("越写越精彩");

</script>

</body>

</html>

JavaScript 注释的使用技巧

5、如果在代码执行语句前面加上一个//,这个代码就不会执行了。

<html>

<body>

<script type="text/javascript">

document.write("<h1>百度经验</h1>");

document.write("我可以出现在网页上");

//document.write("我被限制出现了");

</script>

</body>

</html>

JavaScript 注释的使用技巧

6、如果在代码的前后加上多行注释 之后,这个代码也就不会执行了。

<html>

<body>

<script type="text/javascript">

/*

document.write("<h1>百度经验</h1>");

document.write("我可以出现在网页上");

//document.write("我被限制出现了");

*/

</script>

</body>

</html>

JavaScript 注释的使用技巧

  • JavaScript 使用技巧解析
  • JavaScript 函数的使用技巧
  • javascript的特点
  • 什么是JavaScript函数?
  • 什么是javascript对象,如何理解javascript对象
  • 热门搜索
    苹果电脑怎么截图 路由器怎么重启 魔方怎么玩 猫肉为什么不能吃 手工帽子的做法 wifi密码怎么改 骰子怎么玩 豆苗怎么做好吃 窝瓜的做法大全家常 鼠标灵敏度怎么调