home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / Tools_JScript.asp < prev    next >
Text File  |  1997-10-25  |  2KB  |  98 lines

  1. <%@ LANGUAGE = JScript %>
  2.  
  3.  
  4. <HTML>
  5.     <HEAD>
  6.         <TITLE>Tools Component</TITLE>
  7.     </HEAD>
  8.  
  9.     <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
  10.  
  11.  
  12.         <!-- Display Header -->
  13.  
  14.         <font size="4" face="Arial, Helvetica">
  15.         <b>Tools Component</b></font><br>
  16.       
  17.         <hr size="1" color="#000000">
  18.  
  19.         <%
  20.             var Tools;
  21.             var FoundFile, FileExists, FileDoesNotExist, NotFoundFile;
  22.             var RandInt, RandPosInt, RandIntBelow;
  23.  
  24.             Tools = Server.CreateObject("MSWC.Tools");
  25.         %>
  26.     
  27.  
  28.         <h3> FileExists Example </h3>
  29.     
  30.         <%
  31.             FoundFile = "Tools_VBScript.asp";
  32.             NotFoundFile = "blah.asp";
  33.  
  34.     
  35.             // Check if file exists
  36.     
  37.             FileExists = Tools.FileExists(FoundFile);
  38.  
  39.  
  40.             // Output Response Appropriately
  41.  
  42.             if (FileExists == true)
  43.             { 
  44.                 Response.Write("The File " + FoundFile + " Exists<BR>");
  45.             }
  46.             else
  47.             { 
  48.                 Response.Write("The File " + FoundFile + " Does Not Exist<BR>");
  49.             }
  50.  
  51.  
  52.             // Check if file exists
  53.             
  54.             FileDoesNotExist = Tools.FileExists(NotFoundFile);
  55.  
  56.  
  57.             // Output Response Appropriately
  58.         
  59.             if (FileDoesNotExist == true)
  60.             { 
  61.                 Response.Write("The File " + NotFoundFile + " Exists");
  62.             }
  63.             else
  64.             { 
  65.                 Response.Write("The File " + NotFoundFile + " Does Not Exist");
  66.             }
  67.         %>
  68.     
  69.  
  70.         <h3> Random Integer Example </h3>
  71.     
  72.         <%
  73.             // Random Integer
  74.     
  75.             RandInt = Tools.Random();
  76.             Response.Write("Random integer: ");
  77.             Response.Write(RandInt);
  78.             Response.Write("<BR>");
  79.  
  80.     
  81.             // Positive Random Integer
  82.             
  83.             RandPosInt = Math.abs( Tools.Random() );
  84.             Response.Write("Positive random integer: ");
  85.             Response.Write(RandPosInt);
  86.             Response.Write("<BR>");
  87.  
  88.             
  89.             // Positive Random Integer between 0 and 100
  90.             
  91.             RandIntBelow =  Math.abs( Tools.Random() ) % 100;
  92.             Response.Write("Random integer below 100: ");
  93.             Response.Write(RandIntBelow);
  94.             Response.Write("<BR>");
  95.         %>
  96.     </BODY>
  97. </HTML>
  98.