JavaScript DHTML/Language Basics/Comments

Материал из Web эксперт
Версия от 07:24, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Styles of JavaScript Comments

// I"m a single-line comment 
// This is another comment 
/* Real multiple-line comment to follow */ //Yet another comment 
/************************************************************** 
 * JavaScript module written by Harold Davis 
 * Purpose: Rock, Scissors, and Paper game 
 * Date: 
 * Inputs: 
 * Outputs: 
 * Of special note: Demonstrates conditional statements 
 **************************************************************/



Using JavaScript Comments

<html>
<head>
<title>Using JavaScript comments</title>
</head>
<body>
<script language="JavaScript">
<!-- Begin hiding JavaScript
// document.write("hello world!")
/* document.write("Hello world!")
document.write("Hello World!") */
document.write("HELLO WORLD!")
// End hiding Javascript -->
</script>
</body>
</html>



Using JavaScript Comment Tags

<html>
<head>
  <title>JavaScript Unleashed</title>
</head>
<body>
  <script type="text/javascript">
  <!--
    // Variables
    var firstName = "Jon";
    var lastName = "Simpson";
    var internetAddress = "jsimpson@company.ru";
   
   
    /*------------------------------------------
      Display the user"s first and last name      along with their e-mail address.
    ------------------------------------------*/
    
    // Combine three strings
    document.writeln(firstName + " " + lastName + "<br>"); 
    document.writeln("e-mail address: " + internetAddress);
  // -->
  </script>
</body>
</html>