2025-04-27 07:49:33 -04:00

86 lines
2.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
<title>Get</title>
<script language="JavaScript">
szNavVersion = navigator.appVersion
if (navigator.appName == "Microsoft Internet Explorer") {
if (szNavVersion.indexOf ("4.") >= 0) {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
} else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
}
}
else if (navigator.appName == "Netscape") {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
}
</script>
<meta NAME="DESCRIPTION" CONTENT="Internet Information Server reference information">
</head>
<body BGCOLOR="#FFFFFF" TEXT="#000000">
<font face="Verdana, Arial, Helvetica">
<h1><a name="_get"></a>Get</h1>
<p>The <b>Get </b>method takes the name of a counter and returns the current value of the
counter. If the counter doesn't exist, the method creates it and sets it to 0.</p>
<h2>Syntax</h2>
<pre><b>Counters.Get</b>(<i>CounterName</i>)
</pre>
<h2>Parameters</h2>
<dl>
<dt><i>CounterName</i></dt>
<dd>A string containing the name of the counter.</dd>
</dl>
<h2>Example</h2>
<p>Display the value a counter with <code>&lt;%= Counters.Get(<i>CounterName</i>) %&gt;</code>.
Assign the value of the counter to a variable with <code>&lt;% countervar = Counters.Get(<i>CounterName</i>)
%&gt;</code>. </p>
<p>The following script displays the vote tally from a poll about favorite colors. </p>
<pre>&lt;% If colornumber = &quot;1&quot; Then
Counters.Increment(&quot;greencounter&quot;)
Else
If colornumber = &quot;2&quot; Then
Counters.Increment(&quot;bluecounter&quot;)
Else
If colornumber = &quot;0&quot; Then
Counters.Increment(&quot;redcounter&quot;)
End If
End If
End If %&gt;
&lt;P&gt;Current vote tally:
&lt;P&gt;red: &lt;% =Counters.Get(&quot;redcounter&quot;) %&gt;
&lt;P&gt;green: &lt;% = Counters.Get(&quot;greencounter&quot;) %&gt;
&lt;P&gt;blue: &lt;% = Counters.Get(&quot;bluecounter&quot;) %&gt;
</pre>
<h2>Applies To</h2>
<p>Counters component</p>
<h2>See Also</h2>
<p><a href="counter3.htm"><b>Increment</b></a>, <a href="counter4.htm"><b>Remove</b></a>, <a
href="counter5.htm"><b>Set</b></a> </p>
</font>
</body>
</html>