2011-06-08 46 views
1

我已經創建了與CSS編輯看起來像超鏈接的按鈕,所以我可以使用表單發佈,而不是使用查詢字符串。我已經做到這一點,當點擊一個按鈕時,它會爲每個用戶創建一個複選框。我希望這樣,當我改變複選框的狀態時,我希望它保存,因爲我正在處理不同的字母。我相信我遇到的問題是因爲「超鏈接」實際上是按鈕,更改複選框的選中狀態會產生問題。我寧願不使用JavaScript,但如果它是我獲得我想要的結果的唯一方法,那麼我會使用java腳本。下面的代碼提供 -分頁經典的ASP和按鈕更改爲超鏈接

<form action="Table.asp" method="post" name="form2"> 
<input type="submit" name="Button" value="#" style="background:transparent;border:0;display:inline;color:#00F;text-decoration:underline;padding:0px;cursor:pointer"> 
<% for i = 97 to 122 %>  
    <input type="submit" name="Button" value="<%=CHR(i) %>" style="background:transparent;border:0;display:inline;color:#00F;text-decoration:underline;padding:0px;cursor:pointer;">&nbsp; 
<% next %> 

</br></br></br> 

<% 
    alphaB = request.form("Button") 
if alphaB <>"" then 
     %> 
     <input type="checkbox" name="checkBox" value="<%=alphaB %>" <%=session("checkBox") %>> 
     <% 
     response.write alphaB 


end if 


alphaCheck = request.form("checkBox") 

if alphaCheck <>"" then 
    session("checkBox") = "checked" 
else 
    session("checkBox") = "" 
end if 

回答

2

你得到錯誤是你設置你的會話的地方......

移動

alphaCheck = request.form("checkBox") 
if alphaCheck <>"" then 
    session("checkBox_"&alphaCheck) = "checked" 
else 
    session("checkBox_"&alphaCheck) = "" 
end if 
... 
<input type="checkbox" name="checkBox" value="<%=alphaB %>" <%=session("checkbox_"&alphaB) %>/> 

複選框創建

什麼發生的是,前第一次你的會話沒有初始化,一旦你點擊頁面

+0

好吧,以便比以前更好的工作,但現在我有1最後一個問題。複選框都設置爲檢查值。 – 2011-06-08 15:21:53

+0

你將需要一個不同的會話爲每個複選框會話(「複選框_」和alphaB) – 2011-06-08 15:27:55

+1

實際上我錯了alphaB不會給你正確的信,你將不得不使用alphaCheck值:會話(「複選框_」和alphaCheck) – 2011-06-08 15:30:43

-1
<!--#include file="session_check.asp"--> 
<!--#include file="connection.asp"--> 
<% 

' Last updated by Arun Sharma 
' last updation pourpos mintain the paging of POP closed calls 
' last updated on 6th sep. 2007`enter code here` 

%> 
<% 
    if session("type1")=0 and session("type2") =0 then 
    response.redirect "Default.asp" 
    end if 
%> 

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40"> 

<head> 
<meta http-equiv="Content-Language" content="en-us"> 
<meta name="GENERATOR" content="Microsoft FrontPage 5.0"> 
<meta name="ProgId" content="FrontPage.Editor.Document"> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 

<title>view</title> 


</head> 

<body> 

<% 
If session("type") ="sa" Then 
%> 
<p><!--#include file="header_sa.asp"--></p> 
<% 
else 
%><p><!--#include file="header_a.asp"--></p><% 
End If 
%> 
<!-- 
<table width="100%" style="border-left-width: 0; border-top-width: 0; border-bottom-width: 0"> 
    <tr> 
    <td width="24%" bgcolor="#FFFFFF" style="border-top:medium none #111111; border-bottom:medium none #111111; border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium" height="25">&nbsp;&nbsp; 
    <center> <img border="0" height=90 width=312 src="images/tulipconnect12.jpg">&nbsp;&nbsp;&nbsp;</center> </td> 

    </tr> 
</table> 

<table width="100%" style="border-collapse: collapse" bordercolor="#FFCC99" cellpadding="0" cellspacing="0"> 
    <tr> 
    <td width="20%" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF" bgcolor="#F37D7D"> 
    <b><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; </font> 
    <font color="#006699" face="Verdana" size="2"> 
    <a style="color: #FFFFFF" href="view_list.asp">Home</a></font></b></td> 
    <td width="20%" bgcolor="#F37D7D" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF"> 
    <p align="center"><b>&nbsp;&nbsp; &nbsp;<font face="Verdana" size="2" color="#FFFFFF"> View-Calls</font></b></td> 
    <td width="20%" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF" bgcolor="#F37D7D"> 
    <b><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    </font> 
    <font face="Verdana" color="#FF6600"> 
    <a href="changepassword.asp"><font size="2" color="#FFFFFF">Change</font></a></font><font face="Verdana"><font size="2"><a style="color: #FFFFFF" href="changepassword.asp"> 
    Password</a></font><font color="#FF6600"><a href="changepassword.asp"><font size="2" color="#FFFFFF"> 
    </font> </a> 
    </font></font></b></td> 
    <td width="20%" bgcolor="#F37D7D" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF"> 
    <p align="center"> 
    <b> 
    <font color="#FFFFFF">&nbsp;<font face="Verdana" size="2">&nbsp;&nbsp; <a href="down.ASP"> 
    <font color="#FFFFFF">Downtime Report</font></a></font></font></b></td> 
    <td width="20%" bgcolor="#F37D7D" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF"> 
    <p align="center"> 
    <b> 
    <font color="#FFFFFF">&nbsp;<font face="Verdana" size="2">&nbsp;&nbsp; <a href="LOGOUT.ASP"> 
    <font color="#FFFFFF">Logout</font></a></font></font></b></td> 

    </tr> 
</table> 
--> 
<% 
    if session("type1") =1 then 
    end if 
%> 
    <center> 
    <font color="#F37D7D" face="Georgia, Times New Roman, Times, serif" size="4">&nbsp;</font><font color="#FF3300" face="Georgia, Times New Roman, Times, serif" size="3"><b>Circuit Closed Calls</b></font> 
    </center> 

<% 
    dim name 
    pno=request.querystring("page") 
    name= request.form("engineer") 
    if pno="" then 
    pno=0 
    end if 

'  set con =server.createobject("ADODB.CONNECTION") 
    set rs=server.createobject("ADODB.RECORDSET") 
' con.open "Provider=SQLOLEDB; Data Source = database.tulipconnect.com\CALLMANAGER1; Initial Catalog = support; User Id = app; Password=App_access_2009" 


    sql="select Fault_Ticket_Num,Organisation,Link_Location,Fault_Detail,dDate,tTime,cldate,Assigned_To from Call_Login where Call_Status <> 'OPEN' and region='"&session("region")&"' order by dDate desc" 


    rs.open sql,con 


    %> 





<table height="90%" align="center"> 
<tr> 
<td valign="top"> 
    <table width="95%" height="70" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFCC99" style="border-collapse: collapse"> 
    <tr bordercolor="FF3333" bgcolor="FF3333"> 
    <td width="6%" height="56" align="center" style="border-style: solid; border-width: 1"><b><font face="Verdana" color="#FFFFFF" size="2">Call history</font></b></td> 
    <td width="13%" height="56" align="center" style="border-style: solid; border-width: 1"><font color="#FFFFFF" face="Verdana" size="2"><b>Fault Ticket Number</b></font></td> 
    <td width="9%" height="56" align="center" style="border-style: solid; border-width: 1"><b><font color="#ffffff" face="Verdana" size="2">Organization</font></b></td> 
    <td width="8%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font color="#FFFFFF" face="Verdana" size="2">&nbsp;Location</font></b></td> 
    <td width="25%" height="56" align="center" style="border-style: solid; border-width: 1"><b><font color="#ffffff" face="Verdana" size="2">Fault Details </font> </b> </td> 
    <td width="10%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font face="Verdana" color="#FFFFFF" size="2">Call Status</font></b></td> 
    <td width="8%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font face="Verdana" color="#FFFFFF" size="2">Assigned To</font></b></td> 
    <td width="10%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font color="#FFFFFF" face="Verdana" size="2">Opening Date</font></b></td> 
    <td width="10%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font color="#FFFFFF" face="Verdana" size="2">Closing Date</font></b></td> 
    </tr> 
    <% 
    If rs.eof Then 
     response.write("No call for this user") 
     response.End 
     End if 
     rs.move(10*pno) 
     rno=0 

     while not rs.eof and rno<10 
     rno=rno+1 

    %> 
    <tr> 
    <td width="6%" style="border-style: solid; border-width: 1" bordercolor="#F37D7D" bgcolor="#F9EFF6" height="15"><center> 
     <a href=fault_history.asp?reportid=<%=rs("Fault_Ticket_Num")%>&assignto=<%=rs("Assigned_To")%>> <img border="0" src="images/right_arrow.gif" width="13" height="13"></a> 
    </center></td> 
    <td width="12%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("Fault_Ticket_Num")%></font></td> 
    <td width="9%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("Organisation")%></font></td> 
    <td width="8%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("Link_Location")%></font></td> 
    <td width="25%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("Fault_Detail")%></font><font color="blue" face="verdana"> </font></td> 
    <td width="10%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2> 
     <% response.write("Call Closed")%> 
    </font><font color="blue" face="verdana"> </font>&nbsp;</td> 
    <td width="8%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15">&nbsp;<font color="blue" face="verdana" size=2><%=rs("Assigned_To")%></font><font color="blue" face="verdana"> </font></td> 
    <td width="10%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("dDate")%></font></td> 
    <td width="10%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("clDate")%></font></td> 
    </tr> 
    <% rs.movenext 
    wend 
    %> 
    <tr> 
    <td width="20%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="white" height="15" colspan="7"> 
    <p align="left"> 
    <a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?D1=<%=oth%>&page=<%response.write(0)%>">First</a> 
    <font color="#F37D7D"> 
     <% if pno>0 then 
%> 
     </font>&nbsp;&nbsp;&nbsp; 
     <a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?D1=<%=oth%>&page=<%response.write(pno-1)%>">Previous</a><font color="#F37D7D"> 
     <% end if %> 
     <% 
if rno=10 Then 
pno=pno+1 
    %> 
     </font>&nbsp;&nbsp;&nbsp; <a style="color:#663399; font-family:verdana; font-size:12px" href="view_close.asp?D1=<%=oth%>&page=<%response.write(pno)%>">Next</a><font color="#F37D7D"> 
      <% end if%> 
     </font></p></td> 
    <td width="20%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="white" height="15" colspan="2"><p><a href="view_open_excel.asp"><font color="black" size="2">MOVE TO EXCEL</font></a> </p></td> 
    </tr> 
</table> 

    </form> 





<% 
    pno1=request.querystring("page1") 

%> 
    <center> 
    <p><font color="#F37D7D" face="Georgia, Times New Roman, Times, serif" size="4">&nbsp;</font><font color="#FF3300" face="Georgia, Times New Roman, Times, serif" size="3"><b>POP Closed Call</b></font></p> 
    </center> 
    <% 

    Set rs_pop =server.CreateObject("adodb.recordset") 
    sql_pop_calls="Select distinct(location_b),call_status,fault_detail,ddate,cldate from call_login where pop_call='Y' and call_status='CLOSE' group by location_b,circuit_id,fault_detail,ddate,call_status,cldate" 
    'response.write(sql_pop_calls) 
     rs_pop.open sql_pop_calls ,con %> 

    <table width="95%" height="70" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#FF3300" bgcolor="#FFF0F4" style="border-collapse: collapse"> 
    <tr bgcolor="FF3333"> 
    <td width="5%" height="40" bordercolor="#EED5D5" style="border-style: none; border-width: 1"> 
<b><font face="Verdana" color="#FFFFFF" size="2">S.NO.</font></b></td> 
<td width="10%" height="40" bordercolor="#EED5D5" style="border-style: none; border-width: 1"> 
<b><font face="Verdana" color="#FFFFFF" size="2">POP Name</font></b></td> 
    <td width="19%" height="40" align="left" bordercolor="#EED5D5" style="border-style: none; border-width: 1"> 
    <font color="#FFFFFF" face="Verdana" size="2"><b>Fault Details</b></font></td> 
    <td width="15%" height="40" align="left" bordercolor="#EED5D5" style="border-style: none; border-width: 1"> 
    <b><font color="#FFFFFF" face="Verdana" size="2">Opening Date</font></b></td> 
    <td width="15%" height="40" align="left" bordercolor="#EED5D5" style="border-style: none; border-width: 1"> 
    <b><font color="#FFFFFF" face="Verdana" size="2">Closing Date</font></b></td> 
    <td width="13%" height="40" align="left" bordercolor="#EED5D5" style="border-style: none; border-width:1" > 
    <b><font color="#FFFFFF" face="Verdana" size="2">No. of Affected Circuits</font></b></td> 
    </tr> 
    <% 
    if pno1="" then 
    pno1=1 
    end if 
    if pno1=1 then 
    sno=0 
    else 
    sno=(pno1-1)*10 
    end if 

     rs_pop.move(10*pno1) 
     rno=0 

    'sno=0 
     if not rs_pop.eof then 
      do while not rs_pop.eof and rno<10 
      rno=rno+1 

      sno=sno+1 
      %> 
      <tr> 
      <td align="center"><font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
      <%=sno%></font>   </td> 
      <td> 
      <font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_pop("location_b")%></font>   </td> 
      <td><font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_pop("fault_detail")%></font></td> 
      <td><font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_pop("ddate")%><%'=rs_pop("ddate")%></font></td> 
      <td><font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_pop("cldate")%><%'=rs_pop("ddate")%></font></td> 
      <td>&nbsp;&nbsp; 
      <% 
      set rs_count_fault=server.CreateObject("adodb.recordset") 
      sql_count_fault="select count(circuit_id) as no_of_faults from call_login where ddate='"&rs_pop("ddate")&"' and pop_call='Y' and call_status='CLOSE' and location_b='"&rs_pop("location_b")&"' group by location_b " 
      'response.Write(sql_count_fault) 
      rs_count_fault.open sql_count_fault,con 
      if not rs_count_fault.eof then %> 
      <a href="#" onClick="javascript:imgB('pop_call_effected_cir_list.asp?pop_name=<%=rs_pop("location_b")%>&call_status=<%=rs_pop("call_status")%>&d_date=<%=rs_pop("ddate")%>')" title="View Affected Circuits"> 
      <font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_count_fault("no_of_faults")%></font></a> 

      <% 
      end if 
      %>   </td> 
      </tr> 

     <% rs_pop.movenext 
      loop 
     else 
     %> 
     <tr><td colspan="6"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b>No Open Calls </b></font></td></tr> 
     <% 
     end if 

     %> 

     <tr><td width="20%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="white" height="15" colspan="7"> 
    <p align="left"><a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?page1=<%response.write(1)%>">First</a><font color="#F37D7D"> 
    <% if pno1>1 then 
%>  
    </font>&nbsp;&nbsp;&nbsp; 
    <a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?page1=<%response.write(pno1-1)%>">Previous</a><font color="#F37D7D"> 
     <% end if %> 
     <% 
if rno=10 Then 
pno1=pno1+1 
    %> 
     </font>&nbsp;&nbsp;&nbsp; 
     <a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?page1=<%response.write(pno1)%>">Next</a><font color="#F37D7D"> 
     <% end if%></font></p></td></tr> 
</table> 
<br> 
</td> 
</tr> 
</table> 
    <!--#include file="footer.asp"--> 


    <script> 
function imgB(useridVal) 
{ 
    urlImg=useridVal; 
    nwin1 = window.open(urlImg,"imgB","toolbar=no,directories=no, scrollbars=1, resizable=1,menubar=no,location=no,maximize=yes,width=450,height=230"); 
} 
function boxes() 
{ 
    if(f1.C2.checked==true) 
    { 
     for(i=0;i<f1.C1.length;i++) 
     document.f1.C1[i].checked=true 
    } 
    if(f1.C2.checked==false) 
    { 
     for(i=0;i<f1.C1.length;i++) 
     document.f1.C1[i].checked=false 
    } 
} 
function Delete() 
{ 
    if(confirm("Are you sure")) 
    return true 
    else 
    return false 

    } 

</script> 
     </font> </p> 
</body> 
</html> 
+1

解釋是不好的。你的評論根本不清楚。有些內容與問題無關。最好用文字解釋你想要建議的內容,並只發布必要的代碼。 – 2012-05-02 08:47:22