I have the html code and cascading style sheet all working together, but my javascripting is where I completely fall apart.
This is what I have so far:
var $ = function(id) { return document.getElementById(id); }
//--Variables--//
var deposits = 0;
var withdrawls = 0;
var runningBalance = 2000;
var add_trans = function () {
var amount = parseInt( $("amount").value );
$("deposits").value = ""
if ( isNaN(amount) || amount <= 0 || amount == null ) {
alert ("You must input more than $0.01 to make a deposit.");
} else if ( amount >= 0 ) {
deposits++;
runningBalance += amount;
}
window.onload = function(){
$("add_trans").onclick = add_trans;
}
}
I know from listening to people talk about it that I need to have an array of arrays and a bunch of functions, but as I'm completely new to this most of what they say goes well over my head. Can anyone help me make sense of this, please?

New Topic/Question
Reply


MultiQuote



|