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
ADVERTISEMENT
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
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
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
View Related
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
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
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
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
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
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
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
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
Jul 23, 2005
I have a form that I submit to an asp page. The asp page contains an iframe that needs to receive the form results too. How can I submit the form to both the asp page and the iframe at the same time?
View 1 Replies
View Related
Dec 6, 2011
I just started using jQuery, but i can't get it working. On the index.php page I want a search form, that post's to search.php. Following next, I want that the html of search.php (which will only be a table with the results), is show into the 'results' div in the index.php.
This is the code im using:
<script type="text/javascript">
/* attach a submit handler to the form */
$(document).ready(function(){
alert("Ok - 1");
[Code].....
The alert's are for debugging, but none of them show's up.
View 3 Replies
View Related
Nov 15, 2009
I'm using this example script and need the search results to post to a another frame and not a new window.Need the results to showup in frame "test1".Or if someone can direct me: looking for a multi search drop down list in a frame environment where after submitting the string the results would show in another frame.
View 4 Replies
View Related
Oct 26, 2011
In this function, I'm trying to set the value of isValid with the results of $.post:
[Code]...
Unfortunately, isValid never changes from the initial "true". I know that $.post is working correctly because #msg_code reflects the corresponding message.
View 3 Replies
View Related
Aug 24, 2009
Is it possible to return Query results from a jquery $.ajax POST call?It seems as though it will only return one value. What am I missing? [code]
View 1 Replies
View Related
Mar 25, 2010
I am trying to use a $.post call in jQuery to check a user's credentials before submitting a form (so I can show errors without reloading the page), but I've run into a problem. I know why it is, because AJAX is not synchronous, but I just can't figure out how to do it.
In my code the script I'm making the call to returns "valid" or "invalid". If the return is "valid", I want to submit the form, if not, show an error message. Here is a simplified version:
$("#my_form").submit( function () {
some_value = "username"
$.post(script_location, {data : some_value}, function (data) {
response = data
[Code]...
This obviously does not work because code is executed quickly one after another and the variable "response" is not yet set when the execution gets to the if statement, since it is set sometime later, asynchronously.
I looked into using functions, callbacks, but nothing seems to work properly, I always run into the same issue. This is probably really simple, i just a complete dunce, please do let me know what is the standard way of doing this properly.
View 1 Replies
View Related
Jan 15, 2010
i need to post data from a form to a page on another domain, without leaving the current page.I am using ASP as a server language.
View 9 Replies
View Related
Jan 23, 2011
I'm curious if this is something simple. I'm working on a wordpress site using a plugin that is based off of the code from javascript kit called "highlighter scroller script". The plugin js is almost identical:[URL]..
What is causing it to wipe from left to right? I'm racking my brains trying to figure it out (and googling unsuccessfully it seems). All I'm trying to do is make it wipe instead from right to left. I'm sure it's something simple, but I don't know which variable to change.
View 1 Replies
View Related
Oct 19, 2011
[Code]....
how do i cause the form to post to another page? Am I doing it correct? I want this to happen ONLY if validation passes.
View 4 Replies
View Related
Dec 22, 2010
Here is the code i am trying to update the page and display the results in
div section of html using javascript but i am getting an error message.
Error Messge:
Line: 36
char: 1
Error: Object expected
[Code]....
View 6 Replies
View Related
Mar 20, 2005
I have cfreated form which searchs for results and then displays them on the same page. What I want to do is to create a new page automatically if the results are more thne 10, and then 10-20 results show on the next page and so on. Code:
View 2 Replies
View Related
Mar 16, 2010
I am having problems outputting the results from a javascript search function onto a new page.Right now I am using a javascript search script on 7 pages and it works but the results overwrite the current page that the search was initiated from.I would like it to open a new page and print out into a specific area.I've been grinding my gears at work trying to get this to display right.
View 2 Replies
View Related
Feb 18, 2011
I need to change the result to opening a url page. This script results in a value and I need the result to be open a url page.
<SCRIPT language="Javascript">
nome = new Array(4);
nome[0] = new Array(4);
[code]....
View 4 Replies
View Related
Aug 22, 2010
finding a "find on page" script that will display the results in the middle of the page for IE. I have tried several different ones to no avail. The ones that work in all the browsers display the result in IE at the very bottom of the page. I am not very familiar with programing in Java and I am unable to modify any for my needs. The one I found that did work in IE didn't work in any other browsers.
View 4 Replies
View Related