Hi everyone , Im just new in ASP , I got a problem
Whenever I'll change the value type on <input type="number">
The Total Whole Sale must also automatically change,

here is the code

for ASP code
//code under function QtyTotal()

var x = document.getElementById("total").value
document.getElementById("ntotal").innerHTML = x

//another code
strStream.WriteText "<td><p><input name=""txtQty" & iCount & """ id=""total"" type=""number"" size=""5"" value="""" onchange=""QtyTotal()"" " & sDisabled & "></p></td>" & chr(10)

For HTML code
//code to
<td rowspan="2" id="ntotal">$<%=formatnumber(nTotal,2)%></th>


Whenever I change the value of "txtQty" it doesnt go to the function QtyTotal

Code:
function Qtytotal()
						
				sSQL = "select * from tbl_orders where iOrderID = " & iOrderID
				rs.Open sSQL, DBConn, 3, 3
				rs("sInvoice") = cstr(iOrderID) & "W"
				rs("iStatus") = 1
				rs("sBrand") = sBrand
				rs("iUserID") = session("iUserID")
				rs("iCustomerID") = cint(request("CustomerID"))
				rs.update
				rs.close	
		
			
			'update order information
			dInvoiceDate = request("dInvoice")
			sNotes = request("txtNotes")
			sPurchaseOrder = request("txtPurchaseOrder")
			sSQL = "Select * from tbl_Orders where iOrderID = " & iOrderID
			rs.Open sSQL, DBConn, 3, 3
			rs("dtInvoice") = dInvoiceDate
			rs("dtUpdated") = now()
			rs("sNotes") = sNotes
			rs("sPurchaseOrder") = sPurchaseOrder
			iCustomerID = rs("iCustomerID")
			sCustomerName = getValue(DBConn,"tbl_customers", "sCustomerName","iCustomerID",iCustomerID,"INT","STR")	
			
			if trim(sCustomerName) = "" then
				sCustomerID = Request("cmbCustomer")
				iCustomerID = 0
				if sCustomerID <> "-1" then 
					rs("iCustomerID") = cint(sCustomerID)			
					iCustomerID = cint(sCustomerID)
				end if
			end if		
			rs.Update
			rs.Close
		
		DBConn.Execute("delete from tbl_order_items where iOrderID = " & iOrderID)
			sNumRecs = Request("numRecs")
			iNumRecs = 0
			if sNumRecs <> "" then iNumRecs = clng(sNumRecs)			
			sSQL = "SELECT * FROM tbl_order_items"
			rs.Open sSQL, DBConn, 3, 3
			
		
		nTotal = cdbl(0)
			for i = 1 to iNumRecs
				sItemID = request("hidi" & i)
				iItemID = clng(sItemID)		
				sQty = request("txtQty" & i)
				iQty = 0
				if isNumeric(sQty) then iQty = clng(sQty)
				sDiscount = request("txtDisc" & i)
				nDiscount = 0
				if isNumeric(sDiscount) then nDiscount = round(cDbl(sDiscount),2)
				if iQty <> 0 or nDiscount <> 0 then
					rs.addnew
					rs("iOrderID") = iOrderID
					rs("iItemID") = iItemID
					rs("iQty") = iQty
					rs("nDiscount")  = nDiscount
					rs.update
					nThisQty = 0
					if not isnull(rs("iQty")) then nThisQty = cdbl(rs("iQty"))
					nThisWholesale = 0
					if not isnull(request("txtWholesale" & i)) then nThisWholesale = cdbl(request("txtWholesale" & i))
					nThisDiscount = 0
					if not isnull(rs("nDiscount")) then nThisDiscount = cdbl(rs("nDiscount"))
					nTotal = nTotal + (nThisQty * nThisWholesale)*((100-nThisDiscount)/100)		
				end if		
			next
			rs.close
			
			 var x = document.getElementById("total").value
    document.getElementById("ntotal").innerHTML =  x
		
		end function

Guys please help me