Remove

Remove 메서드는 카운터의 이름을 취하여 Counters 개체에서 해당 카운터를 제거하고 Counters.txt 파일에서 카운터를 삭제합니다.

구문

Counters.Remove(CounterName)

매개 변수

CounterName

카운터의 이름이 들어 있는 문자열입니다.

예제

다음은 Counters.txt 파일에서 카운터 hitscounter를 제거하는 코드입니다.

--- Counters_Remove.asp ---

<HTML>
<HEAD><TITLE>Voting for Colors</TITLE></HEAD>
<BODY>
<%
  vote = Request.QueryString("color")
  clear = Request.QueryString("clear")
  ' The Counters object was instantiated in Global.asa.
  Counters.Increment(vote & "counter")
  If Not ""=clear Then
    Counters.Remove("redcounter")
    Counters.Remove("greencounter")
    Counters.Remove("bluecounter")
  End If
%>
<H3>Vote for your Favorite Color:</H3>
<FORM NAME="Voting for Colors" METHOD="GET" ACTION="Counters_Remove.asp">
<input type="RADIO" NAME="color" VALUE="red">Red
<input type="RADIO" NAME="color" VALUE="green">Green
<input type="RADIO" NAME="color" VALUE="blue">Blue
<BR><INPUT TYPE="SUBMIT" VALUE="Submit Vote">
</FORM>
<H3>Current Vote Tally:</H3>
Red: <% =Counters.Get("redcounter") %><BR>
Green: <% = Counters.Get("greencounter") %><BR> 
Blue: <% = Counters.Get("bluecounter") %>
<FORM NAME="Clear Counters" METHOD="GET" ACTION="Counters_Remove.asp">
<BR><INPUT TYPE="SUBMIT" VALUE="Clear the Counters" NAME="clear">
</FORM>
</BODY>
</HTML>

 

관련 항목

Get, Increment, Set


© 1997-2001 Microsoft Corporation. All rights reserved.