แนะนำ: ASP Tutorial: Master Master ASP Pagination Technology เมื่อเร็ว ๆ นี้ฉันได้อ่านฟอรัมบางอย่างเกี่ยวกับโปรแกรม Paging ASP แต่ยังมีผู้ติดตามอีกหลายคน แต่มีเพียงรหัสและไม่มีคำอธิบายโดยละเอียด สำหรับผู้เริ่มต้นสิ่งนี้จะไม่เชี่ยวชาญอย่างแท้จริง ครั้งนี้ฉันจะอธิบายเทคโนโลยีการเพจโดยละเอียดเพื่อให้ทุกคนสามารถเข้าใจ ASP
หลายครั้งหากคุณไม่ทราบจำนวนแบบฟอร์มที่คุณต้องการคุณจะต้องสามารถควบคุมปริมาณของแบบฟอร์มได้ มีการรวบรวมเอฟเฟกต์สองอย่างต่อไปนี้:
| ต่อไปนี้เป็นเนื้อหาที่ยกมา: <html> <body> <รูปแบบชื่อ = form1> <table id = tb1 border = 0> <tr> <td> <a href =# onclick = return addfj ()> เพิ่มไฟล์แนบ </a> </td> </tr> </table> <ประเภทอินพุต = ชื่อที่ซ่อน = fjcnt value = 1 /> </form> </body> </html> <ภาษาสคริปต์ = JavaScript> ฟังก์ชั่น addfj () - var otb = document.getElementById (tb1); var otr = otb.insertrow (0); var name = thefilename document.form1.fjcnt.value; document.form1.fjcnt.value = parseint (document.form1.fjcnt.value) 1; otr.insertCell (0) .innerhtml = <อินพุต id = 'file' name = 'name' type = file style = 'width: 400px;'> <input type = ปุ่ม onclick = 'return delfj (this)' value = 'delete'> กลับเท็จ; - ฟังก์ชั่น delfj (obj) - obj.parentelement.parentelement.removenode (จริง); กลับเท็จ; - </script> |
| ต่อไปนี้เป็นเนื้อหาที่ยกมา: <html> <head> <style type = text/css> - .p9 {ขนาดตัวอักษร: 9pt; Font-Family: 安体} TD {FONT-SIZE: 9PT} .tx {ความสูง: 16px; ความกว้าง: 30px; สีชายแดน: สีดำสีดำ #000000; ความกว้างด้านบนชายแดน: 0px; ความกว้างของชายแดนขวา: 0px; ความกว้างของชายแดนด้านล่าง: 1px; ความกว้างของชายแดนซ้าย: 0px; ขนาดฟอนต์: 9pt; พื้นหลังสี: #EEEEEEEE; สี: #0000ff} .tx2 {ความสูง: 16px; ความกว้างด้านบนชายแดน: 0px; ความกว้างของชายแดนขวา: 0px; ความกว้างของชายแดนด้านล่าง: 1px; ความกว้างของชายแดนซ้าย: 0px; ขนาดฟอนต์: 9pt; สี: #0000ff; ชายแดนซ้ายสี:#000000; สีสัน-ขวาสี:#000000; สีสันจากสีด้านบน:#000000} .BT {ชายแดนซ้าย: 1px Solid #C0C0C0; Border-Top: 1px Solid #C0C0C0; ขนาดฟอนต์: 9pt; ความกว้างของชายแดนขวา: 1; ความกว้างของชายแดนด้านล่าง: 1; ความสูง: 16px; ความกว้าง: 80px; พื้นหลังสี: #eeeeee; เคอร์เซอร์: มือ; สไตล์ชายแดนขวา: แข็ง; สไตล์ชายแดนด้านล่าง: ของแข็ง} .tx1 {ความกว้าง: 400; ความสูง: 20px; ขนาดฟอนต์: 9pt; ชายแดน: 1px ของแข็ง; สีชายแดน: สีดำสีดำ #000000; สี: #0000ff} - </style> <ภาษาสคริปต์ = vbscript> ฟังก์ชั่น addfile () DIM STR str = <table> ถ้าไม่ใช่ isnumeric (window.form1.filenum.value) จากนั้น window.form1.filenum.value = 1 สำหรับ i = 1 ถึง window.form1.filenum.value str = str & <tr> <td valign = 'middle'> ไฟล์ & i &: </td> <td> <อินพุต type = 'file' name = 'ไฟล์ & i &' class = 'tx1' size = '20 '> บันทึกเป็น <อินพุตประเภท =' text 'name =' file & i & 'size = '20' class = 'tx2' ต่อไป window.uptd.innerhtml = str & </table> ฟังก์ชันสิ้นสุด </script> <ภาษาสคริปต์ = JavaScript> - ฟังก์ชั่นแสดง () - var allnum = document.form1.filenum.value; // รับไฟล์หลายไฟล์ สำหรับ (i = 0; i <allnum; i) - การแจ้งเตือน (ชื่อ: ไฟล์ i ของกล่องไฟล์); - กลับเท็จ; - - </script> <title> </title> <meta http-equiv = เนื้อหาประเภทเนื้อหา = text/html; charset = gb2312> </head> <body bgcolor =#ffffff class = p9 onload = addFile ()>> <วิธีการฟอร์ม = ชื่อโพสต์ = form1 action = savetofile.asp enctype = multipart/form-data> <table border = 0 align = center cellpadding = 0 cellspacing = 0> <tr> <td> <div align = center> <font color =#0000ff size = 5> บันทึกเป็นไฟล์ </font> </div> </td> </tr> <tr> <td> <ความกว้างของตาราง = 750 border = 1 Align = center cellpadding = 0 cellspacing = 0 bordercolor =#1111111 style = การล่มสลายของชายแดน: การล่มสลาย> <tr> <td ความสูง = 27 colspan = 2> อัปโหลด <ชื่ออินพุต = filenum class = tx2 value = 1 size = 4> ไฟล์ <ประเภทอินพุต = ปุ่มชื่อ = ปุ่มคลาส = bt onclick = addFile value = การตั้งค่า> </td> </tr> <tr> <td> <div id = uptd> </div> </td> </tr> <tr> <td height = 30 colspan = 2 allign = middle> <อินพุตประเภท = ปุ่มชื่อ = ปุ่มคลาส = bt value = ดูที่จำนวนกล่องมีกี่กล่อง onClick = show ()> <ประเภทอินพุต = ส่งชื่อ = button class = bt value = upload> <input type = reset name = button class = bt value = reset> </td> </tr> </table> </td> </tr> </table> </form> </body> </html> |
ใน ASP รูปแบบไดนามิกสามารถส่งเป็นรูปแบบปกติ วิธีง่ายๆคือการตั้งชื่อของแบบฟอร์มคงที่ เมื่อมีการส่งหลายรูปแบบข้อมูลของแต่ละแบบฟอร์มจะถูกใช้โดยอัตโนมัติแยกออกจากนั้นแยกออกเป็นแยกและนำกลับมาใช้ใหม่เพื่อส่ง ดังนี้:
| ต่อไปนี้เป็นเนื้อหาที่ยกมา: <%@language = vbscript codepage = 936%> <ภาษาสคริปต์ = JavaScript> ฟังก์ชั่น addTxtProductNameBox () - var otb = document.getElementById (TableProductName); var otr = otb.insertrow (0); otr.insertCell (0) .innerHtml = <ชื่ออินพุต = 'txtProductName' type = 'text'> <อินพุตประเภท = ปุ่ม onclick = 'ส่งคืน deltxtProductNameBox (this)' value = 'ลบ'> กลับเท็จ; - ฟังก์ชั่น deltxtProductNameBox (OBJ) - obj.parentelement.parentelement.removenode (จริง); กลับเท็จ; - </script> <% Dim Rs3, SQL3, ProductnameArray ถ้า ProductName <> แล้ว ตั้งค่า rs3 = server.createObject (adodb.recordset) sql3 = เลือก * จาก amdiproduct Rs3.Open SQL3, Conn, 3,2 ProductnameArray = Split (ProductName ,,) สำหรับ i = 0 ถึง Ubund (ProductnameArray) Rs3.addnew RS3 (companyId) = companyId rs3 (ชื่อผลิตภัณฑ์) = productnamearray (i) rs3.update ต่อไป Rs3.close ตั้งค่า rs3 = ไม่มีอะไร สิ้นสุดถ้า - <form name = form1 method = post action => ชื่อผลิตภัณฑ์: <a href =# onclick = addTxtProductNameBox ()> เพิ่มชื่อผลิตภัณฑ์ </a> <table id = tableProductName border = 0> <tr> <td> </td> </tr> </table> <ชื่ออินพุต = submit type = subment id = submit value === submit == /> </form> |
แบ่งปัน: Simple ASP Forum DIY ก่อนอื่นให้ใช้การเข้าถึงเพื่อสร้างฐานข้อมูลใหม่ตั้งชื่อเป็น Luntan ชื่อของตารางข้อมูลคือข้อมูลและสร้างฟิลด์ต่อไปนี้: ข้อความชื่อเวลาและเวลา & rdquo