關於vb script的問題

看板Visual_Basic作者 (.....)時間19年前 (2006/01/02 12:29), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
我在試dreamweaver的購物車網頁 但在測試階段發生了問題 問題是陣列索引超出範圍 我是個程式白痴不知道要怎麼改 很急著想知道怎麼改 請客位大大如果知道跟我說一下 以下是我的程式碼 <% CONST CC_ProductID = 0 CONST CC_Quantity = 1 CONST CC_Name = 2 CONST CC_Price = 3 CONST CC_UniqueKey = 4 if Request.Cookies("CharonCart") = "" then dim CCcart(5,50) else CCcart=CookieToCart("CharonCart") end if CCcart_SubTotal=0 CCcart_numItems=0 CCcart_Shipping=0 CCcart_Discount=0 CCcart_SalesTax=0 isFound=false for i=0 to ubound(CCcart,2) if CCcart(CC_ProductID,i) <> "" then isFound=true CCcart_SubTotal=CCcart_SubTotal + (CCcart(CC_Quantity,i)*CCcart(CC_Price,i)) CCcart_numItems=CCcart_numItems + 1 end if next function CCcart_LineTotal CCcart_LineTotal=CCcart(CC_Quantity,i)*CCcart(CC_Price,i) end function function CCcart_GrandTotal CCcart_GrandTotal=CCcart_SubTotal + CCcart_Shipping + CCcart_SalesTax - CCcart_Discount end function function CartToCookie(thearray,cookiename) on error resume next mystring="" for j=0 to ubound(CCcart,2) if CCcart(CC_ProductID,j) <> "" then for i=0 to 5 mystring=mystring & CCcart(i,j) & "^" next mystring=left(mystring,len(mystring)-1) mystring=mystring & "|" end if next mystring=left(mystring,len(mystring)-1) Response.Cookies(cookiename)=mystring end function function CookieToCart(cookiename) dim myarray(5,50) mystring=Request.Cookies(cookiename) productarray=split(mystring,"|") for j=0 to ubound(productarray) itemarray=split(productarray(j),"^") for i=0 to 5 if itemarray(i) <> "" then myarray(i,j)=itemarray(i) else myarray(i,j)=null end if next next CookieToCart=myarray end function %> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.201.223.192

01/02 14:47, , 1F
錯誤點在哪都不知道,神仙也難救啊
01/02 14:47, 1F
文章代碼(AID): #13kAmNQ7 (Visual_Basic)
文章代碼(AID): #13kAmNQ7 (Visual_Basic)