ÂÛÎÄÎÞÓÇÍøÌṩ£º¼ÆËã»ú±ÏÒµÂÛÎÄ·¶ÎÄ|¼ÆËã»ú±ÏÒµÉè¼Æ|¼ÆËã»ú±ÏÒµÂÛÎÄ
À¸Ä¿µ¼º½ ASP Java Web .NET VB6.0 JAVA VC VF DELPHI PB ¼ÆËã»úÍøÂç ¼ÆËã»ú¿ÆѧÓë¼¼Êõ PHP °²×¿APP ÆäËû C# ´úдÂÛÎÄ
µ±Ç°Î»ÖÃ: > ¼ÆËã»ú > ASP >

A400156ͶƱϵͳ

µÚ4Õ ÏêϸÉè¼ÆÓëʵÏÖ

ÔËÓÃASPºÍMicrosoft Office Access 2003Ïà½áºÏ¿ª·¢Í¶Æ±ÏµÍ³£¬Í¶Æ±ÏîÄ¿ÒÀ¾ÝѧԺÐèÒª¿ªÉèÄÄЩпγÌÀ´ÖÆ×÷£¬Í¨¹ýѧÉúµÄͶƱ½á¹ûͳ¼ÆÈ·¶¨ÏÂѧÆÚ¿ªÉèµÄпγ̡£ÒÔϾÍÊÇÉè¼ÆͶƱϵͳ²½Öè ÄÚÈÝÀ´×Ôwww.paper51.com

4.1ͶƱ½çÃæÄ£¿éµÄÉè¼Æ paper51.com

ͶƱ½çÃæÄ£¿éµÄ¹¦ÄÜÊÇÃæÏòÀÏʦºÍѧÉúµÄ£¬Òò´Ë²»ÐèҪȨÏÞºËʵ£¬½øÈëϵͳҳÃæºó£¬µã»÷“ͶƱѡÏ´¿É½øÈë¡£ copyright paper51.com

1¡¢Éè¼ÆͶƱ½çÃæ±íµ¥

ÄÚÈÝÀ´×Ôwww.paper51.com

ͶƱÏîÄ¿±íµ¥ÓÉ3²¿·Ö×é³É£º

paper51.com

·Í¶Æ±Ñ¡ÏîÁбí¿ò——ÓÃÀ´Ñ¡ÔñÏàÓ¦ÏîÄ¿½øÐÐͶƱ¡£

paper51.com

·Í¶Æ±°´Å¥¡£ http://www.paper51.com

ÏàÓ¦´úÂëÈçÏ£º

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

Èç¹ûûÓÐͶƱ£¬Ôò±äÁ¿isvotedΪ1£¬¿ÉÒÔͶƱ¡£Í¶Æ±°´Å¥´úÂëÈçÏ£º ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

<input class=Submit type=submit value=' Ͷ  Ʊ ' name="submit onclick='returnSelectChk();'>

ÄÚÈÝÀ´×Ôwww.paper51.com

ÕâÊǸö¿ÉÒÔÑ¡Ôñ¶àÏîµÄͶƱϵͳ£¬ÔÚº¯ÊýSelectChkÖÐÈ¡µÃ±»Í¶Æ±ÏîÄ¿ÐÅÏ¢£¬²¢Ìá½»

copyright paper51.com

//È¡µÃ±»Í¶Æ±ÏîÄ¿µÄ±àºÅ£¬´ò¿ªÐ´°¿Ú£¬²é¿´Í¶Æ±½á¹û

paper51.com

function SelectChk() paper51.com

{

http://www.paper51.com

      vars=false;

http://www.paper51.com

      var deptid,n=0;

copyright paper51.com

      var strid,strurl; ÄÚÈÝÀ´×Ôwww.paper51.com

      var nn =self.document.all.item("poster");

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

      var j;

paper51.com

      for(j=0;j<nn.length;j++) copyright paper51.com

      {

ÄÚÈÝÀ´×Ôwww.paper51.com

             if(self.document.all.item("poster",j).checked) ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

             { paper51.com

                    n= n + 1;

http://www.paper51.com

                    s=true;

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

                     

http://www.paper51.com

                    deptid= self.document.all.item("poster",j).id+""; paper51.com

                   

http://www.paper51.com

                    if(n==1) http://www.paper51.com

                    {

copyright paper51.com

                           strid= deptid;

http://www.paper51.com

                    }

http://www.paper51.com

                    else

copyright paper51.com

                    { ÄÚÈÝÀ´×Ôwww.paper51.com

                           strid = strid + "," + deptid;

paper51.com

                    }

ÄÚÈÝÀ´×Ôwww.paper51.com

             } copyright paper51.com

      }

ÄÚÈÝÀ´×Ôwww.paper51.com

      strurl ="postvote.asp?cid=" + strid; ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

      if(!s)       { http://www.paper51.com

             alert("ÇëÑ¡ÔñͶƱÏîÄ¿!");

copyright paper51.com

             returnfalse; ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

      } ÄÚÈÝÀ´×Ôwww.paper51.com

      window.open(strurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300"); ÄÚÈÝÀ´×Ôwww.paper51.com

      return false;   

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

}

http://www.paper51.com

function newwin(url) {

paper51.com

  varoth="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=200,top=200"; paper51.com

  oth =oth+",width=400,height=300";

http://www.paper51.com

  varnewwin=window.open(url,"newwin",oth); ÄÚÈÝÀ´×Ôwww.paper51.com

  newwin.focus();

ÄÚÈÝÀ´×Ôwww.paper51.com

  return false; ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

copyright paper51.com

ͼ4-2 ͶƱ½çÃæ

ÄÚÈÝÀ´×Ôwww.paper51.com

2¡¢¸ù¾ÝÑ¡Ôñ²éѯÊý¾Ý¿â paper51.com

ÏÂÃæÊÇʵÏÖ¸ÃÏÄܵĴúÂ룺

ÄÚÈÝÀ´×Ôwww.paper51.com

ºÍÊý¾Ý¿â½¨Á¢Á¬½ÓµÄ´úÂëÈçÏ£º

paper51.com

<%

paper51.com

  'Server¶ÔÏóµÄCreateObject·½·¨½¨Á¢Connection¶ÔÏó

http://www.paper51.com

  Set Conn=Server.CreateObject("ADODB.Connection") ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

 Conn.ConnectionString="driver={SQLServer};server=Ntserver;UID=sa;PWD=sa;Database=Vote"

paper51.com

  Conn.Open

copyright paper51.com

%> copyright paper51.com

Õâ¶Î´úÂëʹÓÃOpen·½·¨Á¬½ÓÊý¾Ý¿â¡£

ÄÚÈÝÀ´×Ôwww.paper51.com

USE Vote http://www.paper51.com

GO ÄÚÈÝÀ´×Ôwww.paper51.com

CREATE TABLE VoteItem paper51.com

( Id int Primary KeyIDENTITY,

copyright paper51.com

 Item     varchar(50) NOT NULL,

copyright paper51.com

 VoteCount          int DEFAULT 0 http://www.paper51.com

) ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

´´½¨±ívoteItemµÄ½Å±¾Îļþ

ÄÚÈÝÀ´×Ôwww.paper51.com

USE Vote

http://www.paper51.com

GO paper51.com

CREATE TABLE VoteIP

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

( IP varchar(20)

copyright paper51.com

)

paper51.com

GO

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

±íVoteIPÓÃÀ´±£´æÒѾ­Í¶Æ±µÄIPµØÖ· ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

<%

ÄÚÈÝÀ´×Ôwww.paper51.com

       Dimrs,n ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       n= 0 paper51.com

       Setrs = Server.CreateObject("ADODB.RecordSet")

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       sql= "Select * From VoteItem Order By id" ÄÚÈÝÀ´×Ôwww.paper51.com

       rs.Opensql,Conn,1,1 ÄÚÈÝÀ´×Ôwww.paper51.com

       Ifrs.Bof OR rs.Eof Then

ÄÚÈÝÀ´×Ôwww.paper51.com

         Response.Write "<tr><tdcolspan=3 align=center><font style='COLOR:Red'>Ä¿Ç°»¹Ã»ÓÐͶƱÏîÄ¿¡£</font></td></tr></table>" ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       Else paper51.com

              DoWhile Not rs.Eof http://www.paper51.com

               n= n + 1 http://www.paper51.com

 %> copyright paper51.com

´ÓÊý¾Ý¿âÖÐÌáȡͶƱÏîÄ¿ÐÅÏ¢ ÄÚÈÝÀ´×Ôwww.paper51.com

4.2 ͶƱÏîÄ¿Ä£¿éµÄÉè¼Æ

ÄÚÈÝÀ´×Ôwww.paper51.com

ͶƱÏîÄ¿Ä£¿éµÄ¹¦ÄÜÊǽøÐÐͶƱѡÏîµÄÌí¼Ó£¬Ð޸ģ¬É¾³ý¡£¿ÉÒÔ¸ù¾Ýÿ´ÎÐèҪͶƱµÄÄÚÈݽøÐÐÐ޸ģ¬Ìí¼Ó£¬É¾³ý¡£ ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

1¡¢ÑéÖ¤Óû§ÊÇ·ñµÇ¼

ÄÚÈÝÀ´×Ôwww.paper51.com

ÒòΪֻÓйÜÀíÔ±Óû§²ÅÓÐÐÞ¸ÄÏîÄ¿µÄȨÀû£¬°üÀ¨Ìí¼Ó¡¢Ð޸ġ¢É¾³ý£¬ËùÒÔϵͳÐèÒªÑéÖ¤ÏëÒªÐÞ¸ÄͶƱÏîÄ¿µÄÓû§ÊÇ·ñΪ¹ÜÀíÔ±Óû§¡£Í¨¹ýÑéÖ¤Óû§µÄSession¶ÔÏóµÄlogined±äÁ¿µÄÖµÊÇ·ñΪ1¡£Èç¹ûSession¶ÔÏóµÄlogined±äÁ¿µÄÖµ²»Îª1£¬ÔòÌøתµ½Óû§µÇ¼ҳÃ棨admin.asp£©¡£ ÄÚÈÝÀ´×Ôwww.paper51.com

´úÂëÈçÏ£º ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

<%

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

If Session("logined")<>1 Then

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

     Response.Redirect"admin.asp"

paper51.com

   End If

paper51.com

%> http://www.paper51.com

2¡¢Ìí¼ÓͶƱÏîÄ¿µÄÉè¼ÆÓëʵÏÖ http://www.paper51.com

Ìí¼Ó¿Î³ÌÓÉÒÔϼ¸²¿·Ö×é³É£º ÄÚÈÝÀ´×Ôwww.paper51.com

·Ñ¡Ôñ°´Å¥¿ò——ÓÃÀ´Ñ¡ÔñͶƱѡÏîÃû³Æ¡£ http://www.paper51.com

·µ¥ÐÐÎı¾¿ò——ÓÃÀ´ÊäÈëͶƱÃû³Æ¡£ http://www.paper51.com

ʵÏÖ¹¦ÄܵĹؼü´úÂëÈçÏ£º

http://www.paper51.com

<% copyright paper51.com

      DimSoperate ÄÚÈÝÀ´×Ôwww.paper51.com

      Soperate= Request.QueryString("oper") '²Ù×÷±ê¼Ç ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

      Operid= Request.QueryString("id")    'ÏîÄ¿±àºÅ

ÄÚÈÝÀ´×Ôwww.paper51.com

   If Soperate="add" Then     'Ìí¼ÓÏîÄ¿ http://www.paper51.com

             newTitle= Request("txttitle") copyright paper51.com

             'ÅжÏÊý¾Ý¿âÖÐÊÇ·ñ´æÔÚ´ËÀà±ð copyright paper51.com

             sql= "Select * from VoteItem WhereItem='"&newTitle&"'" copyright paper51.com

             SetrsInsert = Conn.Execute(sql) ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

             IfNOT rsInsert.Eof Then

ÄÚÈÝÀ´×Ôwww.paper51.com

               Response.Write "ÒѾ­´æÔÚ´ËͶƱÏîÄ¿,Ìí¼Óʧ°Ü!"

http://www.paper51.com

             Else

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

            sql ="Insert into VoteItem(Item) values('"&newTitle&"')"

paper51.com

           Conn.Execute(sql)

http://www.paper51.com

               Response.Write"ͶƱÏîÄ¿ÒѾ­³É¹¦Ìí¼Ó£¡"

paper51.com

             EndIf ÄÚÈÝÀ´×Ôwww.paper51.com

      ElseIfSoperate = "edit" Then    'ÐÞ¸ÄÏîÄ¿

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

             newTitle= Request("txttitle") http://www.paper51.com

             orgTitle= Request("sOrgTitle")

ÄÚÈÝÀ´×Ôwww.paper51.com

             'Èç¹ûÐÂÀà±ðÃû³ÆºÍ¾ÉµÄ²»Í¬ÔòÖ´ÐÐ copyright paper51.com

             IfnewTitle<>orgTitle Then

ÄÚÈÝÀ´×Ôwww.paper51.com

                    'ÅжÏÊý¾Ý¿âÖÐÊÇ·ñ´æÔÚ´ËÀà±ð

copyright paper51.com

                    sql = "Select * from VoteItem whereItem='"&newTitle&"'" ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

                    SetrsInsert = Conn.Execute(sql)

paper51.com

                    IfNOT rsInsert.Eof Then http://www.paper51.com

                      Response.Write "ÒѾ­´æÔÚ´ËͶƱÏîÄ¿,Ìí¼Óʧ°Ü!"

http://www.paper51.com

                    Else paper51.com

                    Conn.Execute("UpdateVoteItem set Item='"&newTitle&"' where Id="&cint(Operid))

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

                    Response.Write"ͶƱÏîÄ¿ÒѾ­³É¹¦Ð޸ģ¡" copyright paper51.com

                    EndIf copyright paper51.com

             EndIf

paper51.com

      ElseIfSoperate="delete" Then      'ɾ³ýÏîÄ¿ ÄÚÈÝÀ´×Ôwww.paper51.com

       sqldelt = "Delete from VoteItem Where IdIN("&Cstr(Operid)&")" ÄÚÈÝÀ´×Ôwww.paper51.com

             Conn.Execute(sqldelt)

http://www.paper51.com

             Response.Write"ͶƱÏîÄ¿ÒѾ­³É¹¦É¾³ý£¡" paper51.com

      EndIf

paper51.com

%>

http://www.paper51.com

ɾ³ýÏîÄ¿

paper51.com

function sltAll()

paper51.com

{

ÄÚÈÝÀ´×Ôwww.paper51.com

      varnn = self.document.all.item("dept");

http://www.paper51.com

      for(j=0;j<nn.length;j++)

copyright paper51.com

      {

paper51.com

             self.document.all.item("dept",j).checked= true; ÄÚÈÝÀ´×Ôwww.paper51.com

      }

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

} ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

function sltNull() copyright paper51.com

{

http://www.paper51.com

      varnn = self.document.all.item("dept");

http://www.paper51.com

      for(j=0;j<nn.length;j++)

paper51.com

      { ÄÚÈÝÀ´×Ôwww.paper51.com

             self.document.all.item("dept",j).checked= false; copyright paper51.com

      }

ÄÚÈÝÀ´×Ôwww.paper51.com

} ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

------·Ö¸ôÏß----------------------------
ÁªÏµ·½Ê½