?? myworld3.asp
字號:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/mydb.asp" -->
<%
// *** Edit Operations: declare variables
// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}
// boolean to abort record edit
var MM_abortEdit = false;
// query string to execute
var MM_editQuery = "";
%>
<%
// *** Delete Record: declare variables
if (String(Request("MM_delete")) == "form1" &&
String(Request("MM_recordId")) != "undefined") {
var MM_editConnection = MM_mydb_STRING;
var MM_editTable = "note";
var MM_editColumn = "date";
var MM_recordId = "'" + Request.Form("MM_recordId") + "'";
var MM_editRedirectUrl = "myworld3.asp";
// append the query string to the redirect URL
if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
}
}
%>
<%
// *** Delete Record: construct a sql delete statement and execute it
if (String(Request("MM_delete")) != "undefined" &&
String(Request("MM_recordId")) != "undefined") {
// create the sql delete statement
MM_editQuery = "delete from " + MM_editTable + " where " + MM_editColumn + " = " + MM_recordId;
if (!MM_abortEdit) {
// execute the delete
var MM_editCmd = Server.CreateObject('ADODB.Command');
MM_editCmd.ActiveConnection = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
if (MM_editRedirectUrl) {
Response.Redirect(MM_editRedirectUrl);
}
}
}
%>
<%
var Recordsetnote = Server.CreateObject("ADODB.Recordset");
Recordsetnote.ActiveConnection = MM_mydb_STRING;
Recordsetnote.Source = "SELECT date, text FROM [note] ORDER BY 編號 ASC";
Recordsetnote.CursorType = 0;
Recordsetnote.CursorLocation = 2;
Recordsetnote.LockType = 1;
Recordsetnote.Open();
var Recordsetnote_numRows = 0;
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
var Recordsetnote_total = Recordsetnote.RecordCount;
// set the number of rows displayed on this page
if (Recordsetnote_numRows < 0) { // if repeat region set to all records
Recordsetnote_numRows = Recordsetnote_total;
} else if (Recordsetnote_numRows == 0) { // if no repeat regions
Recordsetnote_numRows = 1;
}
// set the first and last displayed record
var Recordsetnote_first = 1;
var Recordsetnote_last = Recordsetnote_first + Recordsetnote_numRows - 1;
// if we have the correct record count, check the other stats
if (Recordsetnote_total != -1) {
Recordsetnote_numRows = Math.min(Recordsetnote_numRows, Recordsetnote_total);
Recordsetnote_first = Math.min(Recordsetnote_first, Recordsetnote_total);
Recordsetnote_last = Math.min(Recordsetnote_last, Recordsetnote_total);
}
%>
<% var MM_paramName = ""; %>
<%
// *** Move To Record and Go To Record: declare variables
var MM_rs = Recordsetnote;
var MM_rsCount = Recordsetnote_total;
var MM_size = Recordsetnote_numRows;
MM_paramName = "";
var MM_offset = 0;
var MM_atTotal = false;
var MM_paramIsDefined = (MM_paramName != "" && String(Request(MM_paramName)) != "undefined");
%>
<%
// *** Move To Record: handle 'index' or 'offset' parameter
if (!MM_paramIsDefined && MM_rsCount != 0) {
// use index parameter if defined, otherwise use offset parameter
r = String(Request("index"));
if (r == "undefined") r = String(Request("offset"));
if (r && r != "undefined") MM_offset = parseInt(r);
// if we have a record count, check if we are past the end of the recordset
if (MM_rsCount != -1) {
if (MM_offset >= MM_rsCount || MM_offset == -1) { // past end or move last
if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount % MM_size);
} else {
MM_offset = MM_rsCount - MM_size;
}
}
}
// move the cursor to the selected record
for (var i=0; !MM_rs.EOF && (i < MM_offset || MM_offset == -1); i++) {
MM_rs.MoveNext();
}
if (MM_rs.EOF) MM_offset = i; // set MM_offset to the last possible record
}
%>
<%
// *** Move To Record: if we dont know the record count, check the display range
if (MM_rsCount == -1) {
// walk to the end of the display range for this page
for (var i=MM_offset; !MM_rs.EOF && (MM_size < 0 || i < MM_offset + MM_size); i++) {
MM_rs.MoveNext();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if (MM_rs.EOF) {
MM_rsCount = i;
if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;
}
// if we walked off the end, set the offset based on page size
if (MM_rs.EOF && !MM_paramIsDefined) {
if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount % MM_size);
} else {
MM_offset = MM_rsCount - MM_size;
}
}
// reset the cursor to the beginning
if (MM_rs.CursorType > 0) {
if (!MM_rs.BOF) MM_rs.MoveFirst();
} else {
MM_rs.Requery();
}
// move the cursor to the selected record
for (var i=0; !MM_rs.EOF && i < MM_offset; i++) {
MM_rs.MoveNext();
}
}
%>
<%
// *** Move To Record: update recordset stats
// set the first and last displayed record
Recordsetnote_first = MM_offset + 1;
Recordsetnote_last = MM_offset + MM_size;
if (MM_rsCount != -1) {
Recordsetnote_first = Math.min(Recordsetnote_first, MM_rsCount);
Recordsetnote_last = Math.min(Recordsetnote_last, MM_rsCount);
}
// set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount != -1 && MM_offset + MM_size >= MM_rsCount);
%>
<%
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
var MM_removeList = "&index=";
if (MM_paramName != "") MM_removeList += "&" + MM_paramName.toLowerCase() + "=";
var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";
// add the URL parameters to the MM_keepURL string
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}
// add the Form variables to the MM_keepForm string
for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL + MM_keepForm;
if (MM_keepBoth.length > 0) MM_keepBoth = MM_keepBoth.substring(1);
if (MM_keepURL.length > 0) MM_keepURL = MM_keepURL.substring(1);
if (MM_keepForm.length > 0) MM_keepForm = MM_keepForm.substring(1);
%>
<%
// *** Move To Record: set the strings for the first, last, next, and previous links
var MM_moveFirst="",MM_moveLast="",MM_moveNext="",MM_movePrev="";
var MM_keepMove = MM_keepBoth; // keep both Form and URL parameters for moves
var MM_moveParam = "index";
// if the page has a repeated region, remove 'offset' from the maintained parameters
if (MM_size > 1) {
MM_moveParam = "offset";
if (MM_keepMove.length > 0) {
params = MM_keepMove.split("&");
MM_keepMove = "";
for (var i=0; i < params.length; i++) {
var nextItem = params[i].substring(0,params[i].indexOf("="));
if (nextItem.toLowerCase() != MM_moveParam) {
MM_keepMove += "&" + params[i];
}
}
if (MM_keepMove.length > 0) MM_keepMove = MM_keepMove.substring(1);
}
}
// set the strings for the move to links
if (MM_keepMove.length > 0) MM_keepMove = Server.HTMLEncode(MM_keepMove) + "&";
var urlStr = Request.ServerVariables("URL") + "?" + MM_keepMove + MM_moveParam + "=";
MM_moveFirst = urlStr + "0";
MM_moveLast = urlStr + "-1";
MM_moveNext = urlStr + (MM_offset + MM_size);
MM_movePrev = urlStr + Math.max(MM_offset - MM_size,0);
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!-- TemplateBeginEditable name="doctitle" -->
<title>管理日記頁面</title>
<!-- TemplateEndEditable --><script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
body {
background-image: url();
}
.style2 {font-size: 12px}
.style3 {font-size: 14px}
.style4 {color: #6BBC14}
.style5 {color: #8BCC4E}
.style9 {font-size: 12px; color: #70BB35; }
.style12 {color: #FF0000}
-->
</style>
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>
<body>
<table width="919" height="860" align="left" cellspacing="0" bordercolor="#6BBC14">
<tr>
<th width="242" rowspan="3" align="center" valign="top" bgcolor="#FFFFFF" scope="row"><img src="board-left.gif" width="242" height="825">
<div id="Layer3" style="position:absolute; width:177px; height:165px; z-index:3; left: 49px; top: 598px;">
<div align="left" class="style3">
<p>合作站點</p>
<p><a href="http://www.sina.com.cn/"><img src="sina_logo2.gif" width="128" height="41" border="0"></a></p>
<p><a href="http://www.sohu.com/"><img src="sohu.gif" width="160" height="61" border="0"></a></p>
</div>
</div>
<div id="Layer2" style="position:absolute; width:200px; height:115px; z-index:2; left: 35px; top: 193px;"><img src="boardl1.gif" width="174" height="244"> </div> </th>
<td width="618" height="168" align="left" valign="top"><div align="left"> <img src="board.gif" width="618" height="168" hspace="0" vspace="0" align="baseline"> </div></td>
<td width="51" height="168" align="left" valign="top"><div align="right"><img src="board-right.gif" width="51" height="168" hspace="0" vspace="0" align="baseline"> </div> <div align="center"></div></td>
</tr>
<tr>
<td width="618" height="33" align="right"><div align="left">
<span class="style5 style2">我是一個平凡的人 在自己的世界行走 我就是我 別人怎么說與我何干呢</span>
<div id="Layer4" style="position:absolute; width:170px; height:104px; z-index:4; left: 56px; top: 78px;">
<table width="200" border="0">
<tr>
<td colspan="2"><div align="left"><span class="style4">歡迎光臨本站點</span></div></td>
</tr>
<tr>
<td width="14"> </td>
<td width="140"><div align="left"><span class="style4">今天是</span></div></td>
</tr>
<tr>
<td> </td>
<td><div align="left">
<!-- #BeginDate format:Ch2 -->2006年1月3日 <!-- #EndDate -->
</div></td>
</tr>
</table>
</div>
<div id="Layer5" style="position:absolute; width:147px; height:221px; z-index:5; left: 60px; top: 204px;">
<table width="200" height="109" border="0">
<tr>
<td height="17"><div align="left"><a href="index.asp"><img src="boardl3.gif" width="141" height="51" border="0"></a></div></td>
</tr>
<tr>
<td height="17"><div align="left"><a href="reg.asp"><img src="boardl5.gif" width="141" height="51" border="0"></a></div></td>
</tr>
<tr>
<td height="17"><div align="left"><img src="boardl6.gif" width="141" height="51"></div></td>
</tr>
<tr>
<td height="46"><div align="left"><a href="default.asp"><img src="boardl4.gif" width="141" height="51" border="0"></a></div></td>
</tr>
</table>
</div>
<div align="center"></div>
</div>
</td>
<td width="51" rowspan="2" align="left" valign="top"><img src="board-right2.gif" width="51" height="622"></td>
</tr>
<tr>
<td height="649" align="right" valign="top"><div align="left">
<div id="Layer6" style="position:absolute; width:466px; height:582px; z-index:7; background-color: #C8EF85; layer-background-color: #C8EF85; border: 1px none #000000; left: 268px; top: 234px;">
<div id="Layer7" style="position:absolute; width:139px; height:116px; z-index:1; left: 460px; top: -3px;">
<table width="200">
<tr>
<td><img src="cc2.jpg" width="128" height="34"></td>
</tr>
<tr>
<td><a href="myworld4.asp"><img src="cc1.jpg" width="128" height="34" border="0"></a></td>
</tr>
<tr>
<td><img src="cc4.jpg" width="128" height="34"></td>
</tr>
<tr>
<td><a href="myworld1.asp"><img src="cc3.jpg" width="128" height="34" border="0"></a></td>
</tr>
</table>
</div>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1">
<table width="446" border="1" bordercolor="#6BBC15">
<tr>
<td width="49">日期:</td>
<td width="244"><%=(Recordsetnote.Fields.Item("date").Value)%></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>內容:</td>
<td><%=(Recordsetnote.Fields.Item("text").Value)%></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="刪除"></td>
</tr>
</table>
<p>
<input type="hidden" name="MM_delete" value="form1">
<input type="hidden" name="MM_recordId" value="<%= Recordsetnote.Fields.Item("date").Value %>">
</p>
</form>
<table width="145" border="1" bordercolor="#6BBC15">
<tr>
<td><A HREF="<%=MM_movePrev%>">上一篇</A></td>
<td><A HREF="<%=MM_moveNext%>">下一篇</A></td>
</tr>
</table>
<p> </p>
</div>
</div></td>
</tr>
</table>
</body>
</html>
<%
Recordsetnote.Close();
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -