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="JavaS cript" type="text/javascript">
<!-- Hide me from old browsers
// Gets bg colour based on time
time = new Date()
if (time.getHours( ) <= 12) {
document.bgColo r = "CC0000" }
else {
document.bgColo r = "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.flo or(Math.random( )*pic_array.len gth)
if (picnum==0)
picnum=1
document.write( '<center><img src="'+pic_arra y[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_i n) {
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="javascr ipt:document.ba l.Balance.value = bank;">
<br>
Click the amout you wish to deposit
<br>
<IMG onmouseover="wi ndow.status='$5 00'" onclick="deposi t(500)"
onmouseout="win dow.status='';r eturn true" height=75 src="images/0500.gif"
width=200>
<IMG onmouseover="wi ndow.status='$6 00'" onclick="deposi t(600)"
onmouseout="win dow.status='';r eturn true" height=75 src="images/0600.gif"
width=200>
<IMG onmouseover="wi ndow.status='$7 00'" onclick="deposi t(700)"
onmouseout="win dow.status='';r eturn true" height=75 src="images/0700.gif"
width=200><br>
<IMG onmouseover="wi ndow.status='$8 00'" onclick="deposi t(800)"
onmouseout="win dow.status='';r eturn true" height=75 src="images/0800.gif"
width=200>
<IMG onmouseover="wi ndow.status='$9 00'" onclick="deposi t(900)"
onmouseout="win dow.status='';r eturn true" height=75 src="images/0900.gif"
width=200>
<IMG onmouseover="wi ndow.status='$1 000'" onclick="deposi t(1000)"
onmouseout="win dow.status='';r eturn 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.ht ml"><font size="5" face="Comic Sans
MS">Return to casino</font></a></p>
</body>
</html>
--
::::x::::
"Me fail English, that's unpossible" 1 1624
On Thu, 04 Sep 2003 14:39:38 +1000, ::::x:::: wrote: 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="JavaS cript" type="text/javascript"> <!-- Hide me from old browsers
// Gets bg colour based on time time = new Date() if (time.getHours( ) <= 12) { document.bgColo r = "CC0000" } else { document.bgColo r = "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.flo or(Math.random( )*pic_array.len gth) if (picnum==0) picnum=1 document.write( '<center><img src="'+pic_arra y[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_i n) {
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="javascr ipt:document.ba l.Balance.value = bank;"> <br> Click the amout you wish to deposit <br> <IMG onmouseover="wi ndow.status='$5 00'" onclick="deposi t(500)" onmouseout="win dow.status='';r eturn true" height=75 src="images/0500.gif" width=200> <IMG onmouseover="wi ndow.status='$6 00'" onclick="deposi t(600)" onmouseout="win dow.status='';r eturn true" height=75 src="images/0600.gif" width=200> <IMG onmouseover="wi ndow.status='$7 00'" onclick="deposi t(700)" onmouseout="win dow.status='';r eturn true" height=75 src="images/0700.gif" width=200><br> <IMG onmouseover="wi ndow.status='$8 00'" onclick="deposi t(800)" onmouseout="win dow.status='';r eturn true" height=75 src="images/0800.gif" width=200> <IMG onmouseover="wi ndow.status='$9 00'" onclick="deposi t(900)" onmouseout="win dow.status='';r eturn true" height=75 src="images/0900.gif" width=200> <IMG onmouseover="wi ndow.status='$1 000'" onclick="deposi t(1000)" onmouseout="win dow.status='';r eturn 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.ht ml"><font size="5" face="Comic Sans MS">Return to casino</font></a></p> </body> </html>
Hi
It should read like this, then the alert will display the correct value
document.write( "<center><i mg src=" + pic_array[picnum] +
"border=0></center><br>")
*********** all on one line ************
Also the alert is not showing the direct value of bank, but the value of
"money_in" don't know if this will make a difference later in the program.
Have fun
DaveG This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Grrrbau |
last post by:
I'm a beginner.
I'm looking for a good C++ book.
Someone told me about Lafore's "Object-Oriented Programming in C++".
What do you think?
Grrrbau
|
by: japin0 |
last post by:
Hi,
I am a absolute beginner in ASP ..I do have a bit of exposure to .VBS
and other scripting languages.
I need your guidance, where do I start? I had been to MS website Quick
start guide but it says we need a basic web building experience to
undrestand..
Can you please refer to a guide or a website which can cater my need?
rgards
|
by: Jozef |
last post by:
Hello,
I have done a little "old" ASP work along with some javascript. I'm
currently getting into ASP.net and would like to step up my game overall
with regard to Web Development. I was looking at delving into Javascript
and CSS a little more, but I'm not clear on it's relationship with ASP.net.
Are they still useful in a .net environment or does a lot of .net
functionality replace CSS and Javascript?
Any help on the subject would...
|
by: hl |
last post by:
Hi,
I'm a beginner and need a little help with getting data back from a web
service.
I am using VB.Net and have added a web reference to a Wsdl that was
provided to me.
My reference.vb file that was generated has the following code at the end.
<System.Xml.Serialization.SoapTypeAttribute("Map",
|
by: tsivaraman |
last post by:
Hi
I am a PHP ,MySQL newbie.Just finished learning the basics of PHP
programming and MySQL interaction.Can anyone suggest some project
topics that will help me gain hands-on experience in developing a PHP-
MySQL software?
What will be the right approach in developing a "PHP-MySQL" software?
i.e,which part to develop first and which to address next ?
| |
by: chris19845 |
last post by:
Hi there, I am a complete beginner so apologies if I make not a lot of sense.
What I am trying to do is write a simple class, it has a class array variable named test of type String, ie private String test;
I need to write a constructor that will take a string Array as its argument then assign it to the test variable?
I am sure it is very easy, if anyone could help I'd be most grateful
Cheers
|
by: Jack B |
last post by:
I'm using Access 2002 to create a database for a small opera company that my
wife is involved in, and I'm more than a bit rusty because I haven't created
a new Access database since about 1999. So, I will probably have quite a
few questions as I go through this, and hopefully this group will help me
out.
I will be creating this database for someone else to enter the data. I have
a patron table with name, address, email, etc., and I...
|
by: robtyketto |
last post by:
Greetings,
Im a newbie to JSP/Javascript (unfortunalley).
However I found enough example to create code that connects to my access db and populates two combo boxes.
The selection of the first box is used to populate the second (cascading).
See code below, apologies for the formatting as I wrote it in notepad.
I am assuming the code runs through once and therefor combo box populated only once.
|
by: hamza612 |
last post by:
I want to start learning how to program. But I dont know where to
start. From what I've heard so far c++ is not a good lang. to learn
as a beginner because its very complicated compared to others like
python, ruby etc.
I would like to know if there is a prerequisite to learning any
computer language, is there something I have to learn before learning
any computer language, like a basic or core?
|
by: ddg_linux |
last post by:
I have been reading about and doing a lot of php code examples from
books but now I find myself wanting to do something practical with
some of the skills that I have learned.
I am a beginner php programmer and looking for a starting point in
regards to practical projects to work on.
What are some projects that beginner programmers usually start with?
Please list a few that would be good for a beginner PHP programmer to
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |