Yet Another Newbie question
I've been taking Web Design at the local Tech Skool
and have gotten through the first 11 chapters of
/Creating Web Pages with HTML, XHTML and XML/ .
It covers some very elementary Java programming,
mainly doing stupid stuff on webpages.
The final project is creating a _very_ simple
e-commerce website. It's outside the scope of the
class but I'd like to include a rudimentary
shopping cart feature - just some way to keep track
of items added and then list them on the checkout
page. I thought, "Well, I'll just keep the quantity,
description and price in arrays and use the push()
function to put stuff in, then interate through the
arrays when I list the items. Piece of cake."
Oops. It doesn't seem to work that way.
I've done a little C and C++, considerable FORTRAN
and COBOL and great gobs of 360/370 Assembler and
REXX but it looks like Java is a Different Beast.
I could, of course, download one of the free
shopping cart applications but that really woudn't
teach me anything.
I'm going to include what I have so far and would
any kind soul give me a pointer or two?
// JavaScript Document
function e_initialize() {
alert('Initialize script called.');
e_cart_numz = new Array(100);
e_cart_descr = new Array(100);
e_cart_price = new Array(100);
for (index = 0; index < 100; index++)
{ e_cart_numz[index] = -1;
e_cart_descr[index] = "";
e_cart_price[index] = 0; }
}
function e_add_cart (number, description, price) {
var e_cart_numz;
var e_cart_descr;
var e_cart_price;
alert('e_add_cart called.');
alert('number="'+number+'"');
alert('description="'+description+'"');
alert('price="'+price+'"');
var count = e_cart_numz.push(number);
count = e_cart_descr.push(description);
count = e_cart_price.push(price);
return count; }
function e_del_cart (index) {
var e_cart_numz;
var e_cart_descr;
var e_cart_price;
alert('e_del_cart called.');
e_cart_numz[index] = -1 ;
e_cart_descr[index] = "" ;
e_cart_price[index] = 0 ;
return ; }
--
-- Marten Kemp
(Fix name and ISP to reply)