Beginner Needing Help

Giganews Newsgroups
Subject: Beginner Needing Help
Posted by:  ::::x:::: (..@x.com)
Date: Thu, 4 Sep 2003

Hi All,
    below is come code I'm writing for an assignment, and I'm stuck.
What I want to happen:
page load,
user click on money
money = bank
bank is displayed in a text box

I can get the bank to display the initial value of 0, but not the bank value
after the user input.

Cheers..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>:: Tafe - Roll a Dice ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- Casion Emulator - Matthew Howes -->

<script language="JavaScript" type="text/javascript">
<!-- Hide me from old browsers

// Gets bg colour based on time
time = new Date()
if (time.getHours() <= 12) {
document.bgColor = "CC0000" }
else {
document.bgColor = "339900"
}

// Casion Images
function pic(){
pic_array=new Array()
pic_array[1]="images/pic01.gif"
pic_array[2]="images/pic02.gif"
pic_array[3]="images/pic03.gif"
pic_array[4]="images/pic04.gif"
pic_array[5]="images/pic05.gif"
pic_array[6]="images/pic06.gif"

picnum=Math.floor(Math.random()*pic_array.length)
if (picnum==0)
picnum=1
document.write('<center><img src="'+pic_array[picnum]+'"
border=0></center><br>')
}
pic()

// Game starts here

var bank = 0
var money_in = 0
var dep_clickcount = 0
var pick_clickcount = 0
var roll_clickcount = 0

// Prompt for deposit
function deposit(money_in) {

if ( dep_clickcount == 0 ) {
alert( "You Deposited $" + money_in )
bank = money_in
dep_clickcount++
}
  else { alert("You can only make one deposit, hit 'refresh' if you wish to
change your deposit")
  }
}

// end hide -->
</script>

</head>

<body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF"
onload="javascript:document.bal.Balance.value = bank;">
<br>
Click the amout you wish to deposit
<br>
<IMG onmouseover="window.status='$500'" onclick="deposit(500)"
onmouseout="window.status='';return true" height=75 src="images/0500.gif"
width=200>
<IMG onmouseover="window.status='$600'" onclick="deposit(600)"
onmouseout="window.status='';return true" height=75 src="images/0600.gif"
width=200>
<IMG onmouseover="window.status='$700'" onclick="deposit(700)"
onmouseout="window.status='';return true" height=75 src="images/0700.gif"
width=200><br>
<IMG onmouseover="window.status='$800'" onclick="deposit(800)"
onmouseout="window.status='';return true" height=75 src="images/0800.gif"
width=200>
<IMG onmouseover="window.status='$900'" onclick="deposit(900)"
onmouseout="window.status='';return true" height=75 src="images/0900.gif"
width=200>
<IMG onmouseover="window.status='$1000'" onclick="deposit(1000)"
onmouseout="window.status='';return true" height=75 src="images/1000.gif"
width=200>
<br>
<br>
<form name="bal">
<input name="Balance" type="text" value="" size="8" maxlength="8">
</form>
<br>
<p align="center"><a href="casino.html"><font size="5" face="Comic Sans
MS">Return to casino</font></a></p>
</body>
</html>

--
::::x::::

"Me fail English, that's unpossible"

Replies