کمک در مورد asp

rezsat

Member
اين کدرو ببينید
----------------------------------------------------------
<html dir="rtl">
<head>
<link rel="stylesheet" href="OtherPage/U_P_R_M.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
//-------------------Time ------------------->
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >12) ? hours -12 :hours)
if (timeValue == "0") timeValue = 12;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.clock.face.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock() {
stopclock();
showtime();
}
//----------------------PopUp --------------------->
function open_new_window(url)
{
new_window = window.open(url,'window_name','toolbar=0,menubar=0 ,resizable =0,dependent=0,status=0,width=700,height=205,left= 25,top=25' )
}
//---------------------Search --------------------->
var NS4 = (document.layers); // Which browser?
var IE4 = (document.all);

var win = window; // window to search.
var n = 0;

function findInPage(str) {

var txt, i, found;

if (str == "")
return false;

// Find next occurance of the given string on the page, wrap around to the
// start of the page if necessary.

if (NS4) {

// Look for match starting at the current point. If not found, rewind
// back to the first match.

if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;

// If not found in either direction, give message.

if (n == 0)
alert("Not found.");
}

if (IE4) {
txt = win.document.body.createTextRange();

// Find the nth match from the top of the page.

for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("cha racter ", 1);
txt.moveEnd("textedit");
}

// If found, mark it and scroll it into view.

if (found) {
txt.moveStart("cha racter ", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}

// Otherwise, start over at the top of the page and find first match.

else {
if (n > 0) {
n = 0;
findInPage(str);
}

// Not found anywhere, give message.

else
alert("Not found.");
}
}

return false;
}
// End -->
//--------------------Check Box---------------------->
var checkflag = "false";
function check(field)
{
var i;
if (eval(field[0].checked))
{
for (i=0;i<field.length;i++)
field.checked=true;
LL(field);
return "Uncheck All";
}
else
{
for(i=0;i<field.length;i++)
field.checked=false;
UU(field);
return "Check All";
}
}
function LL(field){field.disabled=true;}
function UU(field){field.disabled=false;}
function submitOrder(_form)
{
var _msg = "None Clicked:\n";
_msg += "Air, Monitoring, Water, Pollution Prevention checkboxes have ";
_msg += "been deselected, please select 'All' checkbox.\n";
var anyClicked=false;
for(var i=0;i<_form.list.length;i++)
if(_form.list.checked)
{
anyClicked=true;
_msg += "true*\n";
}
else
{
_msg += "false*\n";
}
if(!anyClicked)
alert(_msg)
//
var _msg2 = "All Clicked:\n";
_msg2 += "Air, Monitoring, Water, Pollution Prevention checkboxes have ";
_msg2 += "been deselected, please select 'All' checkbox.\n";
var allClicked2=true;
for(var i=0;i<_form.list.length;i++)
if(!_form.list.checked)
{
allClicked2=false;
_msg2 += "false*\n";
}
else
{
_msg2 += "true*\n";
}
if(allClicked2)
alert(_msg2)
}
//-------------Del------------------>
function filConfirm()
{
return window.confirm('فایل حذف شود؟');
return true;
}
</script>
<!------------------Table JavaScript Color------------------->
<script type="text/javascript" src="OtherPage/ew.js"></script>
<script type="text/javascript">
<!--
var firstrowoffset = 0; // first data row start at
var usecss = false; // use css
var rowcolor = '#FFFFFF'; // row color
var rowaltcolor = '#E8E8E8'; // row alternate color
var rowmovercolor = '#EDF5F8'; // row mouse over color
var rowselectedcolor = '#CCFFFF'; // row selected color
var roweditcolor = '#FFFF99'; // row edit color
//-->
</script>
<script type="text/javascript">
<!--
var EW_HTMLArea;
//-->
</script>
<!------------------END Table JavaScript Color---------------->
<script language="javascript" src="OtherPage/farsi.js" type="text/javascript"></script>

</head>
<body onLoad="startclock()" background="images/BG5.gif">
<!-- #include file="OtherPage/tarikh.asp" -->
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center" width="15%">
<img src="images/Small-Arm.gif" width="110" height="155" align="right"></td>
<td align="center" width="70%">
<!--------------------------Menu------------- ------------ ----->
<table border="1" width="100%" id="table1" cellspacing="0" cellpadding="0" background="images/BG5.gif">
<tr>
<td align="center" width="10%"><span dir="ltr"><h2><%DisplayNormalDate()%></h2& gt;</span></td>
<td align="center" width="10%">
<a title="Home Page" href="index.asp"><span style="text-decoration: none">خانه</span></a></td>
<td align="center" width="10%">
<a title="Help" href="javascript:eek:pen_new_window('farsihelp.asp'); "><s pan style="text-decoration: none">راهنما</span></a></td>
<td align="center" width="40%"><h1><font color="#000000">ارسال فايل </font></h1></td>
<td align="center" width="10%">
<a title="Login" href="login.asp"><span style="text-decoration: none">ورود</span></a></td>
<td align="center" width="10%">
<a title="About Us" href="AboutUs.asp"><span style="text-decoration: none">درباره</span></a></td>
<td align="center" width="10%">
<FORM name="clock">
<input name="face" size=10 dir="ltr" style="border:1px solid #FFFFFF; float: center; background-image:url('images/BG5.gif'); font-family:Tahoma; font-size:8pt; color:#FF0000; font-weight:bold">
</FORM>
</td>
</tr>
</table> &n bs p;
<!------------------------------------------------------- ----->
</td>
<td align="center" width="15%">
<img src="images/FarsiLogo.gif" width="130" height="65" align="left"></td>
</tr>
</table>

<!------------------------------------Main Page--------------------------------------->
<p align="center"><font color="#FF0000">===></font><a href="Admin.asp?UserName=<%=Request.QueryString("U ser")%& gt;&PassWord=<%=Request.QueryString("Pass")%>&Oper atio n=Del"><span style="text-decoration: none">بازگشت به بخش مديريت</span></a><font color="#FF0000"><===</font></p>
<hr width="20%">
<p align="center"><b><font color="#0000FF"><span style="font-size: 11pt">بخش مديريت متون</span></font><span style="font-size: 11pt"><font color="#FF0000"> </font>(<font color="#0000FF"><span lang="en-us">Emails</span></font>)</span&g t;</b></p>

<% if Request.QueryString("msg") = "1" then %>

<p align="center"><b><font color="#FF0000">فایل مورد نظر حذف گردید </font></b></p>

<% end if %>

<!----------------------------------- Show ------------------------>
<% 'on error resume next
Session.CodePage = 65001
p_sort = Request.QueryString("Sort")
'------------------------------Set Connection----------------------------
' Connection Strings
dim Conn
' Add full path of database with filename here
filepath=server.MapPath("Database/Files.mdb")
Conn = "Provider=Microsoft.JET.OLEDB.4.0; Data Source = " & filepath
'-----------------------------Delete Record-----------------------------
dim rs
dim cn
dim msg

set cn = server.CreateObject("Adodb.Connection")
set rs = server.CreateObject("Adodb.Recordset")
cn.Open conn

if request.Form("Submit")="Delete" then
Call Del()
End if

Sub Del()

dim num
dim i
dim j
dim n
dim Total_Del

num = Request.Form("num")

for i = 1 to num
id = Request.Form("d" & i)
if id<>"" then
rs.Open "Delete From Email Where ID=" & id, cn
Total_Del = Total_Del + 1
end if
next
End Sub &nb sp;
'------------------------------Set Recordset---------------------------------
rs.open "Select * From Email order by "& p_sort &"", cn,3,1,1
if not rs.EOF then
'--------------------------------Per Page------------------------------ &n bsp;
dim PageIndex,TotalPages
dim RecordCount,RecordNumber,Count
dim intpageSize

' Set up records per page dynamically
Dim sWrk
sWrk = Request.Form("RecPerPage")
If sWrk <> "" Then '-------------------------------------------In First Login------------
'Response.Write("sWrkFirst =")
'Response.Write(sWrk) &nb sp; &nb sp;
If IsNumeric(sWrk) Then
intpageSize = CInt(sWrk)
Else
If UCase(sWrk) = "ALL" Then ' Display All Records
intpageSize = -1
Else
intpageSize = 10 ' Non-numeric, Load Default
End If
End If
Session("Files_RecPerPage") = intpageSize
Else '-----------------------------------------------------In Other Login------------
If Session("Files_RecPerPage") <> "" Then
intpageSize = Session("Files_RecPerPage") ' Restore from Session
Else
intpageSize = 10 ' Load Default
End If
End If

Session("Files_RecPerPage") = intpageSize ' Save to Session
If Session("Files_RecPerPage") <> "" Then
intpageSize = Session("Files_RecPerPage") ' Restore from Session
Else
intpageSize = 10 ' Load Default
End If
'----------------------------End Per Page------------------------------ &n bsp;
dim intPrev,intNext &nb sp; &nb sp; &nb sp;
PageIndex = request("PageIndex")
if PageIndex = "" then
PageIndex = "1"
Record Count = rs.RecordCount
Record Number = (intPageSize * PageIndex) - intPageSize
rs.PageSize = intPageSize
rs.AbsolutePage = PageIndex
TotalPages = rs.PageCount
intPrev = PageIndex - 1
intNext = PageIndex + 1
end if
if PageIndex <> "" then
Record Count = rs.RecordCount
Record Number = (intPageSize * PageIndex) - intPageSize
rs.PageSize = intPageSize
rs.AbsolutePage = PageIndex
TotalPages = rs.PageCount
intPrev = PageIndex - 1
intNext = PageIndex + 1
end if
Count = 1
%>

<!---------------------------Search Form------------------>
<div align="center">
<table width="50%" id="table3" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name="search" onSubmit="return findInPage(this.string.value);">
<div align="center"><p><font size=3>
<input type="submit" value="جستجوي در صفحه">
<input name="string" type="text" size=30 onChange="n = 0;" dir="ltr" onkeypress="FKeyPress(search);" onkeydown="FKeyDown(search);">
<img src="images/fa-en.gif" width="82" height="16" onclick="change(string)" style="CURSOR: hand"></p>
</div>
</form> ;
</td>
</tr>
</table>
</div>
<!-----------------------End Search Form------------------>
<!-----------------Change Records Per Page---------------->
<hr width="45%" color="#000000">
<form name="ChangeValue" id="ChangeValue" action="" method="post">
<div align="center">
<table id="table1" cellspacing="0" cellpadding="0">
<tr>
<td><%call button(intPrev,intNext,TotalPages)%></td>
</tr>
<tr>
<td>
<select size="1" name="RecPerPage" style="font-family: Tahoma; font-size: 8pt; font-weight:700">
<option value="1"<% If intPageSize = 1 Then response.write " selected" %>>1</option>
<option value="2"<% If intPageSize = 2 Then response.write " selected" %>>2</option>
<option value="10"<% If intPageSize = 10 Then response.write " selected" %>>10</option>
<option value="15"<% If intPageSize = 15 Then response.write " selected" %>>15</option>
<option value="20"<% If intPageSize = 20 Then response.write " selected" %>>20</option>
</select> &nb sp; &nb sp;
<input type="submit" name="IntPageSizeSub" value="تعداد نمايش در هر صفحه">
</td>
</tr>
</table>
</div>
</form>

<%'--------------------------Page Navigator-----------------
Sub button(intPrev,intNext,TotalPages)
dim Counter
if TotalPages > 1 then
if PageIndex = 1 then %> & nbsp;
<img src="images/lastdisab.gif" width="20" height="16" alt="اول">
<% else %> & nbsp;
<a href="EmailAdmin.asp?Sort=Date_Entry&User=<% = Request.QueryString("User")%>&Pass=<% = Request.QueryString("Pass")%>&PageIndex=1">
<img src="images/last.gif" width="20" height="16" alt="اول"></a>
<% end if
if intPrev <> 0 then%>
<a href="EmailAdmin.asp?Sort=Date_Entry&User=<% = Request.QueryString("User")%>&Pass=<% = Request.QueryString("Pass")%>&PageIndex=<% = intPrev%>">
<img src="images/next.gif" width="20" height="16" alt="قبلي"></a>
<% else %>
<img src="images/nextdisab.gif" width="20" height="16" alt="قبلي"> &nbs p;
<%end if
Counter = 1%><font color="#FF0000"><b>صفحه شماره</b></font>
<%While Counter <= TotalPages
if cint(Counter) = cint(PageIndex) then %>
<b><%resp onse.write Counter %></b>
<% else %>
<a href=EmailAdmin.asp?Sort=Date_Entry&User=<% = Request.QueryString("User")%>&Pass=<% = Request.QueryString("Pass")%>&PageIndex=<% = Counter%>><% = Counter%></a>
<% end if
if cint(Counter) <> cint(TotalPages) then%>
<b><font color="#FF0000">|</font></b>
<% End if
Counter = Counter + 1
wend
if rs.AbsolutePage <> TotalPages then %>
<a href="EmailAdmin.asp?Sort=Date_Entry&User=<% = Request.QueryString("User")%>&Pass=<% = Request.QueryString("Pass")%>&PageIndex=<% = intNext%>">
<img src="images/prev.gif" width="20" height="16" alt="بعدي"></a>
<% else %>
<img src="images/prevdisab.gif" width="20" height="16" alt="بعدي">
<% end if
if "a" & PageIndex = "a" & TotalPages then %> & nbsp;
<img src="images/firstdisab.gif" width="20" height="16" alt="اخر">
<% else %> & nbsp;
<a href="EmailAdmin.asp?Sort=Date_Entry&User=<% = Request.QueryString("User")%>&Pass=<% = Request.QueryString("Pass")%>&PageIndex=<%= TotalPages%>">
<img src="images/first.gif" width="20" height="16" alt="اخر"></a>
<% end if
End if
End Sub
%>
<!-------------End Change Records Per Page------------->
<hr width="45%" color="#000000">
<form name="form1" method="post" action="" onsubmit="return filConfirm();">
<table border="1" width="100%" id="table4" cellspacing="0" cellpadding="0" style="border-left-width: 0px; border-bottom-width: 0px; border-right-width:0px">
<tr>
<td align="center" width="2%"> </td>
<td align="center" width="23%"><b><font color="#FF0000">
<a href="EmailAdmin.asp?Sort=FName"><span style="text-decoration: none">
<a href="EmailAdmin.asp?Sort=FName&User=<%=Request.Qu eryStri ng("User")%>&Pass=<%=Request.QueryString("Pass")%> " >
<img src="images/Up-Arr1.gif" width="15" height="14"></a></span></a>فرستنده<a href="EmailAdmin.asp?Sort=FName Desc"><span style="text-decoration: none">
<a href="EmailAdmin.asp?Sort=FName Desc&User=<%=Request.QueryString("User")%>&Pass=<% = Request.QueryString("Pass")%>">
<img src="images/Down-Arr1.gif" width="15" height="14"></a></span></a></font> ; ;</b>
</td>
<td align="center" width="40%"><b><font color="#FF0000">
<a href="EmailAdmin.asp?Sort=Sub"><span style="text-decoration: none">
<a href="EmailAdmin.asp?Sort=Sub&User=<%=Request.Quer yString ("User")%>&Pass=<%=Request.QueryString("Pass")%>"& g t;
<img src="images/Up-Arr1.gif" width="15" height="14"></a></span></a></font> ; ;</b><font color="#FF0000"><b>موضوع</b></font>< b><font color="#FF0000"><a href="EmailAdmin.asp?Sort=Sub Desc"><span style="text-decoration: none">
<a href="EmailAdmin.asp?Sort=Sub Desc&User=<%=Request.QueryString("User")%>&Pass=<% = Request.QueryString("Pass")%>">
<img src="images/Down-Arr1.gif" width="15" height="14"></a></span></a></font> ; ;</b>
</td>
<td align="center" width="10%"><b><font color="#FF0000">
<a href="EmailAdmin.asp?Sort=Date_Entry"><span style="text-decoration: none">
<a href="EmailAdmin.asp?Sort=Date_Entry&User=<%=Reque st.Quer yString("User")%>&Pass=<%=Request.QueryString("Pas s")% >">
<img src="images/Up-Arr1.gif" width="15" height="14"></a></span></a></font> ; ;</b><font color="#FF0000"><b>تاريخ ارسال</b></font><b><font color="#FF0000"><a href="EmailAdmin.asp?Sort=Date_Entry Desc"><span style="text-decoration: none">
<a href="EmailAdmin.asp?Sort=Date_Entry Desc&User=<%=Request.QueryString("User")%>&Pass=<% = Request.QueryString("Pass")%>">
<img src="images/Down-Arr1.gif" width="15" height="14"></a></span></a></font> ; ;</b>
</td>
<td align="center" width="3%"><input type="checkbox" id="list" name="toggleAll" title="Select or deselect all messages" onClick="this.value=check(this.form.list);"></td>
</tr>
<% while not rs.EOF and Count<=intPageSize
n = n + 1
j = j + 1
p_id=rs("ID")

dim k, p, rowColor

p = k Mod 2
if p <> 0 then
rowColor = "#FFFFFF"
else
rowColor = "#E5E5E5"
end if
%>

<tr bgcolor=<% = rowColor%> onmouseover='ew_mouseover(this);' onmouseout='ew_mouseout(this);'>
<td align="center" width="3%"><font color="#FF0000"><%=j%></font></td>
<td align="center" width="25%"><% = rs.Fields("FName") %></td>
<td align="center" width="49%"><a href="EmailPreview.asp?ID=<%= rs.Fields("ID")%>&User=<%=Request.QueryString("Use r")% >&Pass=<%=Request.QueryString("Pass")%>"><spa n style="text-decoration: none"><% = rs.Fields("Sub") %></span></a></td>
<td align="center" width="17%"><% = rs.Fields("Date_Entry") %></td>
<td align="center" width="6%"><input id="list" type="checkbox" name=d<%=n%> value="<%=rs.Fields("ID")%>"><font size="2"></td>
</tr>

<%
k=k+1
rs.MoveNext
Count=Count +1
wend
%>

<tr>
<td align="center" colspan="4" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: none; border-bottom-width: medium"></td>
<td align="center" width="6%" style="border-left-style: none; border-left-width: medium; border-right-style:none; border-right-width:medium">
<input id=submit type=submit value=Delete name=submit></td>
</tr>
</table>
<!------------------------------------------------------- ------>
<input type="hidden" name="num" value="<%=n%>">
<input type="hidden" name="User" value="<%=Request.QueryString("User")%>">
<input type="hidden" name="Pass" value="<%=Request.QueryString("Pass")%>">
</form>
<!------------------- ------ ---------------------------------------->

<% Else %>

<p align="center"><b><font color="#FF0000">هيچ <span lang="fa">متني</span> در سرور موجود نمي باشد</font></b></p>

<% end if
rs.Close
cn.Close %>

</body>
</html>
------------------------------------------------------------ -
مشکل اينجاست که وقتی مثلا انتخاب ميکنم که تو هر صفحه ۲ رکورد نشون بده و مثلا ميشه ۵ صفحه اگه من برم تو صفحه مثلا ۴ بعد از صفحه ۴ که هستم تعداد نمايشهای در صفحه رو بيشتر کنم مثلا ۱۰ تا خوب تعداد صفحات کمتر خواهد شد و احتمال زياد ديگه صفحه ۴ وجود نخواهد داشت.قاعدش اينه که بره و دوباره از صفحه ۱ ولی با ۱۰ رکورد در صفحه نمايش داده بشه ولی تو همون صفحه ۴ باقی ميمونه و چيزی هم نشون نميده و برای ديدن بايد با زدن کليد برگشت به اولين صفحه بتونم اطلاعاتو ببينم.اگه ميشه کمک کنید.مر۳۰
 

جدیدترین ارسال ها

بالا