⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xuanju.asp

📁 用于选举集中上来的手工选票的记录与统计
💻 ASP
字号:
<% @language=VBScript %>
<%
option explicit 
dim cnn,strcnn
set cnn=server.createobject("ADODB.Connection")
strcnn="Provider = Microsoft.Jet.OLEDB.4.0; Data Source = "&Server.Mappath("xjdb.mdb")
cnn.open strcnn
dim hxrcount,hxr,fhxrcount,fhxr
dim Filetongji
dim Ffps,Fhxrps
dim Fxqrs

set   hxrcount = cnn.execute("select count(*) from hxr")
set   hxr      = cnn.execute("select * from hxr")

set   fhxrcount = cnn.execute("select count(*) from fhxr")
set   fhxr      = cnn.execute("select * from fhxr")

set   Filetongji      = cnn.execute("select * from tongji where id='tongji'")

set   Fhxrps       = cnn.execute("select * from  hxrps")
set   Ffps      = cnn.execute("select * from  fhxrps")

set   Fxqrs    =cnn.execute("select xqrs from xqs where id='xqkey'")
dim revxxs

revxxs=Fxqrs(0)
set Fxqrs=nothing
dim hxrnum,fhxrnum


hxrnum=hxrcount(0)

fhxrnum=fhxrcount(0)


function  strlen(str)
dim l,t,c,i
l=len(str)
t=l
for i=1 to l
c=asc(mid(str,i,1))
 if c<0 then
    c=c+65536 
 end if
 if c>255 then 
    t=t+1
 end if
next
strlen=t
end function

function namechange(str)
dim Ctmp,m,strone
	Ctmp=""
	strone=""
if strlen(str)>=10 then
	
	strone=Left(str,10)
else
	strone=str
end if
for m=1 to (10-strlen(trim(str)))
        Ctmp=Ctmp&" "
next
namechange=strone+Ctmp
end function	

%>



<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>唱票</title>
</head>


<script language="javascript"> 


function bianbian()
{

if   (event.srcElement.id=="0")
   {
   event.srcElement.style.background="#E6E3E6"
   event.srcElement.style.color="#993333"
   
   event.srcElement.style.borderStyle="inset"
   event.srcElement.id="1"
   } 
else 
	if (event.srcElement.id=="1")
   {
   event.srcElement.style.background="#C0C0C0"
   event.srcElement.style.color="#000000"

   event.srcElement.style.borderStyle="outset"
   event.srcElement.id="0"
   }
   
}


function addfhxr(Jn)
{
  window.open("dbaddfhxr.asp?fhxrname="+Jn,"aa","left=2000,top=3");
  window.location="xuanju.asp";	
}
	
function openwin(str)
{
window.open("dbokxp.asp?"+str,"okxp","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=2000,top=3");
}

function qqxuanpiao()
{
window.open("dbqqxp.asp","qqxp","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=2000,top=3");
}

function initpbox()
{
	if (confirm("确认要清空票箱吗?[将造成所有选票数据清零]"))
	{
	window.open("dbinitpx.asp","initpx","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=2000,top=3");
  window.location="xuanju.asp";	
  }
}


function dellast()
{
	if (confirm("是否删除最后一张选票?"))
	{
	window.open("dblast.asp","dellast","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=2000,top=3");
	window.location="xuanju.asp";	
	}
}


</script>


<script language="vbscript">

function onaddfhxr()

dim revjn
 revjn=inputbox("输入姓名:","增加非候选人","",5000,4000)
 if revjn="" then
	  
 else
	  addfhxr(revjn)	
 end if

end function

function  onqq()
	 if confirm("确认要增加一张弃权票吗?") then
	 	<%
	dim qqi,qqj
	for qqi=1 to hxrnum
	%>
	  formhk.hxr<%=qqi%>.style.background="#C0C0C0"
    formhk.hxr<%=qqi%>.style.color="#000000"
    formhk.hxr<%=qqi%>.style.borderStyle="outset"
    formhk.hxr<%=qqi%>.id="0"
  <%
    next

  for qqj=1 to fhxrnum
  %>
    formhk.fhxr<%=qqj%>.style.background="#C0C0C0"
    formhk.fhxr<%=qqj%>.style.color="#000000"
    formhk.fhxr<%=qqj%>.style.borderStyle="outset"
    formhk.fhxr<%=qqj%>.id="0"
  <%
  next
  %>
	 	
	    qqxuanpiao()
	    
	 end if
end function


function okxuanpiao()

  dim tmpstr
  tmpstr=""
	<%
	dim xhi,xhj
	for xhi=1 to hxrnum
	%>
	  tmpstr=tmpstr+"hxr<%=xhi%>name="+trim(formhk.hxr<%=xhi%>.value)+"&hxr<%=xhi%>id="+formhk.hxr<%=xhi%>.id+"&"
  <%
    next

  for xhj=1 to fhxrnum
  %>
  tmpstr=tmpstr+"fhxr<%=xhj%>name="+trim(formhk.fhxr<%=xhj%>.value)+"&fhxr<%=xhj%>id="+formhk.fhxr<%=xhj%>.id+"&"
  <%
  next
  %>
  tmpstr=tmpstr+"xzs="+trim(formhk.xxs.value)
  
  <%
	for xhi=1 to hxrnum
	%>
	
    formhk.hxr<%=xhi%>.style.background="#C0C0C0"
    formhk.hxr<%=xhi%>.style.color="#000000"
    formhk.hxr<%=xhi%>.style.borderStyle="outset"
    formhk.hxr<%=xhi%>.id="0"
  <%
  next

  for xhj=1 to fhxrnum
  %>
  
    formhk.fhxr<%=xhj%>.style.background="#C0C0C0"
    formhk.fhxr<%=xhj%>.style.color="#000000"
    formhk.fhxr<%=xhj%>.style.borderStyle="outset"
    formhk.fhxr<%=xhj%>.id="0"
  <%
  next
  %>   
  openwin(tmpstr)

end function

function onokxp()

 if formhk.xxs.value="0" then
   alert("限选数为零,请输入合适的限选数")
 else
	
	okxuanpiao()
	
 end if 

end function

</script>


<body  background="5.jpg">

<div align="center">
  <center>

<table border="0" width="947" cellpadding="0" cellspacing="0" height="502">
	
<form name="formhk">
  <tr>
    <td width="744" height="18" align="center" colspan="5" bordercolor="#000000" bordercolorlight="#E6E3E6" bordercolordark="#808080" style="border-style: outset; border-width: 1"><b><font size="3" color="#0000FF"><em>候选人名单及选票情况</em></font></b></td>
    <td width="197" height="544" rowspan="11" valign="top" align="center"> 
    	<%if  hxrnum >0 then%>
      <p><input type="button" value="  选票确定  " name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="onokxp()"></p>
      <p><input type="button" value="  弃权选票  " name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="onqq()"></p>
      <p><input type="button" value="删除最后一票" name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="dellast()"></p>
      <p><input type="button" value="非候选人选票" name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="onaddfhxr()"></p>
      <p> </p>
      <p><font color="#0000FF" face="仿宋_GB2312"><u>投票统计</u></font></p>
      <p><font color="#800000" face="仿宋_GB2312">总票数</font><input type="text" name="totalnum" size="5" value="<%=Filetongji(1)%>" style="color: #0000FF; text-align: center"></p>
      <p><font color="#800000" face="仿宋_GB2312">有效票</font><input type="text" name="use" size="5"  value="<%=Filetongji(2)%>"  style="color: #0000FF; text-align: center"></p>
      <p><font color="#800000" face="仿宋_GB2312">无效票</font><input type="text" name="nouse" size="5"  value="<%=Filetongji(3)%>"  style="color: #0000FF; text-align: center"></p>
      <p><font color="#800000" face="仿宋_GB2312">弃权票</font><input type="text" name="nonum" size="5"  value="<%=Filetongji(4)%>"  style="color: #0000FF; text-align: center"></p>
      <p><font color="#800000" face="仿宋_GB2312">限选数</font><input type="text" name="xxs" size="5"  style="color: #0000FF; text-align: center"></p>
      <p><input type="button" value="  清空票箱  " name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="initpbox()"></td>
      <%
       else   
      %>
      <p><input type="button" value="  选票确定  " name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="okxuanpiao()" disabled></p>
      <p><input type="button" value="  弃权选票  " name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="onqq()" disabled></p>
      <p><input type="button" value="删除最后一票" name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" disabled></p>
      <p><input type="button" value="非候选人选票" name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="onaddfhxr()" disabled></p>
      <p> </p>
      <p><font color="#0000FF" face="仿宋_GB2312"><u>投票统计</u></font></p>
      <p><font color="#800000" face="仿宋_GB2312">总票数</font><input type="text" name="totalnum" size="5" value="<%=Filetongji(1)%>" style="color: #0000FF; text-align: center" disabled></p>
      <p><font color="#800000" face="仿宋_GB2312">有效票</font><input type="text" name="use" size="5"  value="<%=Filetongji(2)%>"  style="color: #0000FF; text-align: center" disabled></p>
      <p><font color="#800000" face="仿宋_GB2312">无效票</font><input type="text" name="nouse" size="5"  value="<%=Filetongji(3)%>"  style="color: #0000FF; text-align: center" disabled></p>
      <p><font color="#800000" face="仿宋_GB2312">弃权票</font><input type="text" name="nonum" size="5"  value="<%=Filetongji(4)%>"  style="color: #0000FF; text-align: center" disabled></p>
      <p><font color="#800000" face="仿宋_GB2312">限选数</font><input type="text" name="xxs" size="5"  style="color: #0000FF; text-align: center" disabled></p>
      <p><input type="button" value="  清空票箱  " name="B3" style="font-size: 12pt; font-family: 仿宋_GB2312"  disabled></td>
       <script>
       	alert("没有候选人,请在候选人登记中添加候选人")
       	</script>
      <%end if%>
  </tr>
 
  <tr> <%
  	   dim i,j
  	    i=1
  	    j=1
  	  do while not hxr.eof
  	  	%>
  	  
    <td width="151" height="60" align="center" valign="middle"><input type="button" value="个人[   ]票" name="ps<%=j%>" style="background-color: #0000FF; color: #FFFF00; font-family: 仿宋_GB2312; font-size: 10pt; border-style: solid; border-width: 1; padding: 1"><input type="button" value="<%=namechange(hxr(1))%>" name="hxr<%=j%>" id="0" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="bianbian()"></td>
    <%
      i=i+1
      j=j+1
      if i>5 then
     %>
    </tr>
    <tr>
    <%
      i=1
     end if
      hxr.movenext
      loop
     
    dim k,p
    p=j
    for k=0 to (15-j)
    if p>=5 then
    %>
  </tr>
  <tr>
    <%
    p=1
     end if
     p=p+1
    %>
     
    <td width="151" height="60" align="center" valign="middle"></td>
    <%
    next
      %>
  </tr>
  
 
  <tr>
    <td width="756" height="30" align="center" valign="middle" colspan="5">
      <hr>
    </td>
  </tr>
  
  <tr>
  	
  	 <%
  	   dim fi,fj
  	    fi=1
  	    fj=1
  	  do while not fhxr.eof
  	  	%>
  	  
    <td width="151" height="60" align="center" valign="middle"><input type="button" value="个人[   ]票" name="fps<%=fj%>" style="background-color: #0000FF; color: #FFFF00; font-family: 仿宋_GB2312; font-size: 10pt; border-style: solid; border-width: 1; padding: 1"><input type="button" value="<%=namechange(fhxr(1))%>" name="fhxr<%=fj%>" id="0" style="font-size: 12pt; font-family: 仿宋_GB2312" onclick="bianbian()"></td>
    <%
      fi=fi+1
      fj=fj+1
      if fi>5 then
     %>
    </tr>
    <tr>
    <%
      fi=1
     end if
      fhxr.movenext
      loop
     
    dim fk,fp
    fp=fj
    for fk=0 to (15-fj)
    if fp>=5 then
    %>
  </tr>
  <tr>
    <%
    fp=1
     end if
     fp=fp+1
    %>
     
    <td width="151" height="60" align="center" valign="middle"></td>
    <%
    next
      %>
  	
  </tr>
  	
    <td width="756" height="30" align="center" valign="middle" colspan="5">
      <hr>
    </td>
  </tr>
  <script language="vbscript">
  	formhk.xxs.value="<%=revxxs%>"
  <%
	dim psi,psj
	for psi=1 to hxrnum
	%>
	
	formhk.ps<%=psi%>.value="个人[<%=Fhxrps(2)%>]票"
	
	<%
	Fhxrps.movenext
  next
  
  
	for psj=1 to fhxrnum
	%>
	
	formhk.fps<%=psj%>.value="个人[<%=Ffps(2)%>]票"
	
	<%
	Ffps.movenext
  next
  %>
	
</script>
  </form>
</table>

  </center>
</div>

<p> </p>

</body>

</html>



<%

cnn.close
set Fhxrps=nothing
set Ffps=nothing
set hxrcount=nothing
set hxr=nothing
set fhxrcount=nothing
set fhxr=nothing
set Filetongji=nothing
set cnn=nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -