"Lauritz Jensen" <lauritz2@hotmail.com> wrote in message
news:3A30ECEE.1569263F@hotmail.com...
[snip]
> Jeg tror du vil have større chance for at få hjælp, hvis du poster et
> url til kildekoden.
[snap]
Hej!
Jeg har også rodet lidt med eksemplet.
Her er urlen.
www.asp24h.com
(filerne ligger i Asp24hSamples\Ch24)
samt lidt af koden hvor fejlen opstår.
Michael
Sub AddProductToBag(avarProduct, BagItems)
Set XMLDoc = BagItems.ownerDocument
Set nodeFind = BagItems.selectNodes("product[@productid=""" &
nProductId & """]")
If Not nodeFind.length > 0 Then
Set product = XMLDoc.createElement("product")
Set attr = XMLDoc.createAttribute("productid")
attr.Text = avarProduct(0,0)
product.attributes.setNamedItem(attr)
Set attr = XMLDoc.createAttribute("productname")
attr.Text = Server.HtmlEncode(avarProduct(1,0))
product.attributes.setNamedItem(attr)
Set attr = XMLDoc.createAttribute("quantityperunit")
attr.Text = Server.HtmlEncode(avarProduct(2,0))
product.attributes.setNamedItem(attr)
Set attr = XMLDoc.createAttribute("unitprice")
attr.Text = avarProduct(3,0)
product.attributes.setNamedItem(attr)
product.text = "1"
BagItems.appendChild(product)
End If
End Sub
Sub Out(strOut)
Response.Write strOut
End Sub
Sub PrintBag(BagItems)
Out "<FORM METHOD=""POST"" ACTION="""
Out Request.ServerVariables("SCRIPT_NAME") & """>"
Out "<TABLE><TR><TH>Units</TH><TH COLSPAN=2>"
Out "Product</TH><TH>Unit Price</TH><TH>Price</TH>"
Out "</TR>" & vbCrLf
For Each item In BagItems.childNodes
Out ("<TR><TD><input type=""TEXT"" name=""Qty")
!!!!!!!!!!!!!!!!!!!!!!!!HEREFTER OPSTÅR DER PROBLEMER
Out (item.attributes.getNamedItem("productid"))
Out (""" VALUE=""" & item.text & """ SIZE=""3"">")
Out ("<TD>" & item.attributes.getNamedItem("productname"))
Out ("</TD><TD>" & item.attributes.getNamedItem("quantityperunit") &
"</TD>")
nUnitPrice = item.attributes.getNamedItem("unitprice")
nSubTotal = item.text * nUnitPrice
nTotal = nTotal + nSubTotal
Out ("<TD>" & FormatCurrency(nUnitPrice) & "</TD>")
Out ("<TD><B>" & FormatCurrency(nSubTotal) & "</B></TD>")
Out ("</TR>" & vbCRLF)
Next
Out "<TR><TD COLSPAN=5><HR></TD></TR>"
Out "<TR><TD COLSPAN=3></TD><TD><B>Total:</B></TD>"
Out "<TD><B>" & FormatCurrency(nTotal) & "</B></TD></TR>" & vbCrLf
Out "<TR><TD COLSPAN=5 ALIGN=""RIGHT"">"
Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Shop for more""> "
Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Recalculate""> "
Out "<INPUT TYPE=SUBMIT NAME=""DO"" VALUE=""Check out"">"
Out "</TD></TR></TABLE></FORM>"
End Sub