Dice Roll Betting Calculator ?

Mar 28, 2009

Im currently taking some computer science courses in university and kind of enjoy this javascript stuff! im trying to figure out this final program...

Here is what is needed: Enhance the previous example, so the user can bet on the outcome of the roll, i.e. she can try to guess if the roll is going to be even or odd. If the user makes the right guess, she wins the amount of the bet, otherwise she loses the amount of the bet. The initial value of the wallet should be 100.

You should use 3 functions for this exercise. One function is executed when the user presses the button. The other functions (win and lose) are called by the first function when the user wins or loses.

This is the code i have so far. The "first function" was working perfectly. Now not only will the picture not show up when the "Roll!" button is pressed, but i cant figure out the even and odd assignments.

View 14 Replies


ADVERTISEMENT

Dice Roller - Script That Will Roll Dice And Post The Results To The Page

Mar 7, 2011

Before I go on, I should state that I know little of Javascript - tried learning it once, but it was way over my head.

On to the problem: I found a script that will roll dice and post the results to the page. In my case, everything is working except for the fact it doesn't post the results.

Here is the dice roller: [url]

What it should be doing: [url]

I've sent a message to it's creator, but he hasn't responded yet. I'm not sure what exactly the problem is, so I won't post the page source here (it can get fairly long).

View 4 Replies View Related

Update Amountleft On Dice Game Roll?

Jun 10, 2009

I am just about finished the dice game but am having trouble doing the calculation where if a player wins then they double their venture. I am not too sure how the game stores what the user picks in their venture 100 or 200.

I am already subtracting their venture from the total when they initially make their venture. But if they win then I need to add back the venture to the total by 2. Not too sure how to do this. Do I use a new function. How can I tell which button the user chooses 100 or 200 and then add on that amount.

[Code]...

View 6 Replies View Related

Creating A Dice Game Where 6 Dice Are 'rolled' By You And 6 Dice Are 'rolled' By The Player

Nov 14, 2011

Create a game where 6 dice are 'rolled' by you and 6 dice are 'rolled' by the player (simulated by the click of a button). Add up both rolls. The goal is to come as close to a score of 100 as possible, without passing 100. Have a STOP button to signify when you are ready to stop rolling and compute the winner. The highest score under 100 wins. Display the number of times you win and the number of times the computer wins using javascript. So far I have the following code, however, my dice images are not working(they display as little broken symbols when I run the game). The game itself is running just fine but I can't figure out how to get the game to do the "Add up both rolls" step and beyond.

View 1 Replies View Related

Create A Dice Game ?

Apr 10, 2010

I am studying webdesign and we also go through a chapter of javascript-programming. Our first assignment is to create a dice game. I have written a code and in the beginning it worked, except that all the dices showed the same random number. I tried to fix that and now I do not know what I have done! In the game, you shall click on a link and the three dices will show random numbers.

Here is my code:

View 1 Replies View Related

Conditionals Dice Rolls

Nov 5, 2004

I am having trouble creating a page that stimulates a large number of dice rolls and computes the average of the dice totals in an separate text box. Code:

View 1 Replies View Related

Showing History With A Dice Program

Mar 30, 2009

I'm making a dice program, that randomly draws x amount of times for x sided die. I decided to add on a "history" feature to this program--displaying the previous rolls (unlimited I imagine) and to show the math that comes from that equation. Everything works perfect except for the history function.

I've got a div area sectioned off with the id divhistory. At the end of the dice rolling program it calls function fhistory(z). Where z is the string that displays the random rolls and total (1 + 3 + 2 = 6).

Heres the code I've been fusing over. I imagine it's horribly off--but I'm also terrible with arrays it seems...

View 2 Replies View Related

Making Dice Game 2 Player ?

Nov 16, 2009

I'm trying to make a dice game, as well as making it two player. I need to be able to have a scoreboard displayed (eg. player 1 has won 7 times and player 2 has won 4) and I need to be able to prompt the user on if they want to play the game again.

So far I have the following:

I basically just tried duplicating the original function that adds up the 'dice'. But it doesn't work, I've tried playing around with if/else statements etc to get it to display messages and so fourth, but I have failed.

View 1 Replies View Related

Make A Doubled Dice Game ?

Dec 9, 2011

How to make a dice game for two player in javascript and html using just two dice?

1. Each player throws both dice once per turn. You only score if you throw doubles (that is, both dice have the same number of spots on their top face).

2. Players score five points for double ones, twos, fours or fives. A double six scores twenty five points, but if you throw a double three your score goes back to zero.

3. Add your score as you play. The first player to get fifty points wins the game. (An adult or older child may need to help score, but you can use this game to teach younger children to count by fives.)

View 3 Replies View Related

Dice Roller - Passing - Rolling - Output ?

Oct 30, 2011

I am taking a JavaScript class and I am currently on an assignment where my Professor wants me to create a dice roller program with the following stipulations:

Now to the problems. I have set up to where it will take the form, pass it to my "sidecheck" function, but I do not think it is passing it to the Die() function to roll the die. As far as the output part of it to show roll totals and percentages, I am lost on that one.

Below is my code and what I have so far.

View 1 Replies View Related

Enlarge Image On Roll Over?

Aug 29, 2009

I'm wondering if anyone knows of some simple javascript that allows me to create a floating image rollover enlargement, similar to the ones on the homepage of ThemeForest [URL]

View 2 Replies View Related

Expanding Navigation Roll Over?

Jan 24, 2011

Can anyone show me the code for a simple expanding navigation bar? I need to roll over the nav bar and for it to drop down with more options.

I know the code will be straight forward, I can't work it out though.

View 1 Replies View Related

Dice Game - Show The Sums Of The Dices On The Screen

Nov 10, 2010

Developing a dice game. I'm totally new at this so a bit confused with the javascript language...

Anyways, heres my code:

So what i need help with is my pictures. They wont show. Firebug says: "document.getElementById("dice" + i) is null", and I have tried to solve that but with no progress...

Next step is to show the sums of the dices on the screen and also save this sums to be able to show them later on in an alert window... But that is for later, right now the dices needs to show the right (random) sides...

View 9 Replies View Related

JQuery :: Fade In Image Roll-over?

Apr 13, 2010

So I wrote a code to simply display an image when a link is rolled over:

[URL]

The problem (which you may have already noticed) is that when you rollover the two links fast, the images appear below each other. What I want to do is find a way to make the images appear on top of each other so it will look more like they're crossfading without changing the shape of the site.

View 1 Replies View Related

Apply A Roll-over Effect Under Some Circumstances?

Jan 9, 2010

I have a question about an example of a card game and i would really appreciate any help i could get.Below are the codes i have used for it: Html code:

Code:
<html>
<head>
<title>Poker Solitaire</title>[code].........

I want to apply a roll-over effect(with an image named "p.gif")but only if the card is currently a blank card.It it possible to do it without using regular expressions?

View 1 Replies View Related

Message Appear When Roll Mouse Over Picture?

Aug 27, 2005

i have never used javascript at all apart from a very small amout in dreamweaver.

anyway, i would like to have it so when i roll the mouse over a picture a brief message apears explaining the picture.

View 4 Replies View Related

ROLL OVER MENU In Client Side How?

Dec 27, 2006

I know how to make a ROLL OVER MENU, but the problem is the image is loading from the server side.

What i want is to put all the images into memory of computer of the client so that when the client hover the mouse the images is not fetch from the server but from on the client side.

View 3 Replies View Related

Dropdown Menus Do Not Show Up On Roll-over

Feb 26, 2010

I recently created a website with a spry dropdown navigation bar. On preview from Dreamweaver CS4, in Firefox, IE, Opera, Chrome, all elements work properly and the dropdown menus work as well. However, when I upload it to my server at the domain URl..., the dropdown menus do not show up on rollover. I don't know what is going on. The .js file and .css file are both appropriately linked to the root folders as well.The dropdowns are supposed to be displayed under 'online resources' and 'citing your work'

View 4 Replies View Related

Combining A Randomized Array With A Roll-over Image?

May 30, 2010

I can put together some fairly simple HTML,and can borrow chunks of JS code to suit certain basic purposes. I have managed to accomplish two separate goals using javascript, but am having trouble combining their results. I have created an image link that randomly calls a URL from an array. I also have a separate roll-over image. What I am trying to do is have the link that accesses the array also be a roll-over image. I can't seem to accomplish this.

[URL]

This URL is what I am working on. The "b" symbol is the roll-over. The "right" arrow accesses an array at: [URL] I have tried simply adding my roll-over code to randomize.js and adjusting the array accordingly, but that doesn't seem to work.I would like the "right" arrow to be a roll-over image as the "b" symbol is, but also access the "randomize" array as it currently does.My problem is that my understanding of JS isn't great enough to determine how separate pieces of code might be combined or function together.

View 2 Replies View Related

JQuery :: Add Fade Functionality To Simple Roll-over Code?

Jul 27, 2009

I'm totally new to jquery, however I got a script working The script is looking for images with the class "thumbnail" and exchanges them by rollover....

jQuery(document).ready(function(){
jQuery("img.thumbnail").hover(
function()

[code].....

View 15 Replies View Related

JQuery :: Insert A Class Selector When Roll Mouse Over An Image?

Apr 5, 2010

1. I want to have 2 things on my page: an unordered list of links at left, and a grid of images at right. Each item in the list is represented by an image in the grid. This is how it should work: when you mouse over an image, the text link at left changes color. So, I hardly know any jQuery, but I suspect that you need to dynamically insert a css class selector into the <li> for that list item. How in the world do I do this?

2. I am using this plugin: jQuery cycle lite. Is there a way to make the images appear in random order, rather than in the same, fixed order?

View 4 Replies View Related

Short Blip Sound Played Whenever Roll Over The Links In The Sidebar

Dec 20, 2010

the person whose site this is wants a short blip sound played whenever you roll over the links in the sidebar. I know it's not advised, but she insists. I've tried implementing a few scripts but no luck in Firefox or Chrome.

View 2 Replies View Related

JQuery :: Make A Conditional Function For A Menu So The Current Link Does Another Roll Over?

Nov 1, 2010

I'm trying to build a menu with an animation color and my problem is that the funtion is apply to all the links in the menu but ideally I would like to apply to all elements less the one with the id current.

at the moment I just created two functions but still apply both of them to the current link.

Here is the code:

<script type="text/javascript">
// font color animation
$(".second a").hover(function() {
$(this).animate({ color: "#00aadd" }, 400);

[Code].....

View 1 Replies View Related

Dice Game - Text Box For The First Number And Text Box For The Second

Nov 15, 2009

Im trying to make a dice game. how to get started n stuff. Something that will create a random number b/w 1 n 6 and decide if the user is a winner. He will win only if the #s are equal

So i want a text box for the first number and text box for the second. a button to click to play the game(roll the dice) button to start over and reset all values textbox to display the # of tries(rolls) textbox 2 display the # of wins. Also i want toKeep track of the number of times the user rolls the dice and display this in the appropriate textbox and the number of times the user wins the game and display this in the appropriate textbox.

Well my friend helped me with this but he made 2 player i only want one player and i want the number of tries and win the user wins if the #s are equal and i want a start over button that resets everything. Also the max number i want is 6 and only one roll the dice button but 2 textboxes so if you get same # you win it should appear in alert and text box for tries and wins. Also, i am gonna have 2 pics one for the first textbox the other for the second both of the pics are gonna be dice and i am gonna have 12 pics but only 2 appear at a time so if a guy gets 5 the dice with the #5 appears and the other text gets 4 the dice with the # 4 appears

<html>

View 26 Replies View Related

Working On An Mpg Calculator ?

Oct 4, 2009

I am working on an Mpg calculator and I am stuck.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

I have a mistake when it is suppose to calculate.

View 4 Replies View Related

Make A Calculator App?

Mar 25, 2011

I'm trying to make a calculator app; with a few differences. I have a text field with a numberpad below it, I got the numbers to show up in the text field, but am unsure as to how when I hit the enter button - it would store them in a variable?...I am also wondering as to how it would store current value and then allow me to input another value(maybe on the next page) and either subtract or add to it(the first value that is stored).I am also wondering how to get a decimal point in place(need it for currency).

Here is my code:

<html>
<head>
<script type = "text/javascript">

[code].....

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved