Working On A DHTML / Sodoku Game
Sep 30, 2010
My ultimate goal is to generate a puzzle, and allow the user to solve it. When the user makes a guess, I will check their guess to make sure they did not make a mistake. If they did make a mistake the cell/textbox should turn red until they fix the problem. Once the board is filled, I will make one last check to make sure they have everything correct.So far I have a game board with text areas, and that is about it. I have ideas about how to do the rest, but I have a few hang ups. My idea was to have a matrix that represents the game board. I have already given all of the text boxes names that correspond to their positions in the matrix. I need help writing some kind of loop to go through the whole game board, and if a value is found store that value into the matrix in it's proper place. I also need help doing the reverse, taking values from the matrix and print them into the text boxes.
View 4 Replies
ADVERTISEMENT
Jul 23, 2005
Are there methods for manipulating images in JavaScript that would allow me
to write functions to rotate, skew, mask and resize images (bitmaps)?
The functions need to be fast enough for use in a top-down scrolling game.
Or would I be better off preprocessing all of the images with something
server side such as PHP and then preloading them into my JavaScript already
manipulated?
The only thing I don't like about the idea of preprocessing the images is
that I will have to preload a very large number of images, ie all of the
sprites rotated at different angles, resized at different sizes etc.
I am considering using Flash but because it would involve learning
ActionScript I would prefer to do it with a combination of JavaScript and
PHP. The other alternative that I was considering was using SVG, but not
many people have an SVG capable browser or have downloaded the SVG plugin.
View 21 Replies
View Related
May 10, 2010
I am working on a Javascript application and i am facing a strange behavior of the application in IE. I am creating a table at runtime using DHTML and registering event for the table row click. When i deploy this application on web server and browse the application, the events fires in firefox and chrome but in IE the events are not fired. If i browse the application from the server with localhost, the application triggers the events and fails when i use machine name.
The following is the source code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
[Code]....
View 4 Replies
View Related
Jul 26, 2011
My pages all have the same blank at start then the images slide up trick. I have an old workaround for IE that stopped working, and I don't know what to do. In IE now nothing shows up.
View 1 Replies
View Related
Mar 15, 2010
Here is the CODE:
<!--BEGIN FADING DYNAMIC CONTENT SCRIPT-->
<script language="javascript">
// Use Freely as long as following messages are intact ::
[Code]....
It is supposed to fade all the images, but the images don't fade. But if I put text at the place of image, the text fades. But I want my image to fade too.
The image URL provided in this script is of the root Dir, therefore you will not be able to see any image.
View 5 Replies
View Related
Sep 5, 2006
I am having an issue dynamically displaying a table row.
What I would like to accomplish is when I click the show label, the 2nd row of the table is made visiable but it also remains in the table order (all td elements should align).
The below code works in IE but in Netscape, both the label and the text box apear in the first TD element instead of having the label appear in the first TD element and the text box apearing in the 2nd TD element. Does anyone know a way around this so the code works in both IE and Netscape? Code:
View 4 Replies
View Related
Jan 19, 2011
I know I have a simple syntax error. Trying to call a function which changes the style of a div element on mouseover. Heres my code.
Javascript
function countermarker1(){
var box1 = document.getElementById('countermarker1box').style.display
box1 = "block" }
Variable is used cause I will have to use it more often later in the script.
HTML
<div id="countermarker1">
<img src="countermarker.jpg" width="20" height="14"
onmouseover = "countermarker1()"; /></div>
CSS (know its not really relevant just to avoid questions about whether its right)
#countermarker1box {
height: auto;
width: 80px;
display: none;
}
JS and css is externally srced.
View 6 Replies
View Related
Mar 3, 2010
I am using a dhtml "Image Slideshow", and I was really happy with I customized its layout to my needs, and it runs perfectly on FF and on IE (wich is very important for me, since in my country most of people still use IE). Check it hereHowever, when I insert the slideshow in my design, it stops working on IE (working in perfection on FF):I am using the original slideshow file in an iframe.(before I tryed to paste the code directly into the page, but it didn't worked, so I thought using an iframe would work, because the code of the original document would be intact)
View 5 Replies
View Related
Oct 3, 2003
Have a look at this maths game I made. It tests you on adding, subtracting, multiplying and dividing and has three different levels.
Note-you must save the code below as mathsgamefinal.htm for the reset button to work.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-gb">
<title></title>
</head>
<body bgcolor="#FF0000">
<script type="text/javascript">
function next1(){
var outof=document.getElementById('outof').value;
if(document.getElementById('next').value=="Next" && document.getElementById('type').value=="a"){document.getElementById('next').value='Enter' add(); document.getElementById('answer').value='answer'}
else if(document.getElementById('next').value=="Next" && document.getElementById('type').value=="m"){document.getElementById('next').value='Enter' times(); document.getElementById('answer').value='answer'}
else if(document.getElementById('next').value=="Next" && document.getElementById('type').value=="t"){document.getElementById('next').value='Enter' minus(); document.getElementById('answer').value='answer'}
else if(document.getElementById('next').value=="Next" && document.getElementById('type').value=="d"){document.getElementById('next').value='Enter' divide(); document.getElementById('answer').value='answer'}
else if(document.getElementById('next').value=="Enter" && document.getElementById('answer').value==(cr)){ document.getElementById('question').value='Correct' document.getElementById('next').value='Next' document.getElementById('outof').value=parseInt(document.getElementById('outof').value)+1; document.getElementById('score').value=parseInt(document.getElementById('score').value)+1; pc();}
else{ document.getElementById('question').value='Wrong. Answer= '+cr; document.getElementById('next').value='Next' document.getElementById('outof').value=parseInt(document.getElementById('outof').value)+1; pc();}
document.getElementById('answer').select();
}
function add(){
ea1=(Math.floor(Math.random() * (1 - 10)) + 10);
ea2=(Math.floor(Math.random() * (1 - 10)) + 10);
ma1=(Math.floor(Math.random() * (21 - 49)) + 49);
ma2=(Math.floor(Math.random() * (21 - 49)) + 49);
ha1=(Math.floor(Math.random() * (111 - 299)) + 299);
ha2=(Math.floor(Math.random() * (111 - 299)) + 299);
if(document.getElementById('level').value=="e"){document.getElementById('question').value=ea1+' plus '+ea2; cr=ea1+ea2}
if(document.getElementById('level').value=="m"){document.getElementById('question').value=ma1+' plus '+ma2; cr=ma1+ma2}
if(document.getElementById('level').value=="h"){document.getElementById('question').value=ha1+' plus '+ha2; cr=ha1+ha2}
}
function times(){
em1=(Math.floor(Math.random() * (2 - 10)) + 10);
em2=(Math.floor(Math.random() * (2 - 10)) + 10);
mm1=(Math.floor(Math.random() * (11 - 19)) + 19);
mm2=(Math.floor(Math.random() * (6 - 12)) + 12);
hm1=(Math.floor(Math.random() * (21 - 29)) + 29);
hm2=(Math.floor(Math.random() * (21 - 29)) + 29);
if(document.getElementById('level').value=="e"){document.getElementById('question').value=em1+' times '+em2; cr=em1*em2}
if(document.getElementById('level').value=="m"){document.getElementById('question').value=mm1+' times '+mm2; cr=mm1*mm2}
if(document.getElementById('level').value=="h"){document.getElementById('question').value=hm1+' times '+hm2; cr=hm1*hm2}
}
function minus(){
et1=(Math.floor(Math.random() * (10 - 20)) + 20);
et2=(Math.floor(Math.random() * (1 - 10)) + 10);
mt1=(Math.floor(Math.random() * (50 - 99)) + 99);
mt2=(Math.floor(Math.random() * (20 - 50)) + 50);
ht1=(Math.floor(Math.random() * (350 - 1000)) + 1000);
ht2=(Math.floor(Math.random() * (350 - 1000)) + 1000);
if(document.getElementById('level').value=="e"){document.getElementById('question').value=et1+' minus '+et2; cr=et1-et2}
if(document.getElementById('level').value=="m"){document.getElementById('question').value=mt1+' minus '+mt2; cr=mt1-mt2}
if(document.getElementById('level').value=="h"){document.getElementById('question').value=ht1+' minus '+ht2; cr=ht1-ht2}
}
function divide(){
ed1=(Math.floor(Math.random() * (2 - 10)) + 10);
ed2=(Math.floor(Math.random() * (2 - 10)) + 10);
md1=(Math.floor(Math.random() * (11 - 19)) + 19);
md2=(Math.floor(Math.random() * (11 - 19)) + 19);
hd1=(Math.floor(Math.random() * (21 - 29)) + 29);
hd2=(Math.floor(Math.random() * (21 - 29)) + 29);
ed3=ed1*ed2;
md3=md1*md2;
hd3=hd1*hd2;
if(document.getElementById('level').value=="e"){document.getElementById('question').value=ed3+' divided by '+ed2; cr=ed1}
if(document.getElementById('level').value=="m"){document.getElementById('question').value=md3+' divided by '+md2; cr=md1}
if(document.getElementById('level').value=="h"){document.getElementById('question').value=hd3+' divided by '+hd2; cr=hd1}
}
function answerreset(){
if(document.getElementById('answer').value=="answer"){document.getElementById('answer').value=''}
}
function pc(){
document.getElementById('scorepercent').value=document.getElementById('score').value/document.getElementById('outof').value*100;
document.getElementById('scorepercent').value=Math.round(document.getElementById('scorepercent').val ue);
}
</script>
<table border="0" width="198" height="180" bordercolor="#000000" style="background-color: #FFFF00; border-style: solid">
<tr>
<td height="33" width="99" colspan="2">
<p align="center">
<select size="1" name="type" id='type'>
<option value="a" selected>Add</option>
<option value="t">Take away</option>
<option value="m">Multiply</option>
<option value="d">Divide</option>
</select></p>
</td>
<td height="36" width="99" colspan="2">
<p align="center">
<select size="1" name="level" id=level>
<option value="e" selected>Easy</option>
<option value="m">Medium</option>
<option value="h">Hard</option>
</select></p>
</td>
</tr>
<tr>
<td height="36" width="198" colspan="4">
<p align="left">
<input type="button" name="T1" id='question' value="Click next to begin" style="background-color: #FFFF00; border: 0 solid #FFFF00">
</p>
</td>
</tr>
<tr>
<td height="33" width="66">
<p align="center"><input type="text" name="answer" size="6" id='answer' onclick=answerreset()></td>
<td height="36" width="66" colspan="2">
<p align="center"><button onclick='next1()' id='next'>Next</button></td>
<td height="33" width="66">
<p align="center"><button onclick='window.location="mathsgamefinal.htm"'>Reset</button></td>
</tr>
<tr>
<td height="36" width="66">
<p align="center">Score %:</td>
<td height="33" width="66" colspan="2">
<p align="center">Score Marks:</td>
<td height="33" width="66">
<p align="center">Out of:</td>
</tr>
<tr>
<td height="33" width="66">
<p align="center"><input type="button" name="T1" size="3" id=scorepercent value="0"></td>
<td height="33" width="66" colspan="2">
<p align="center"><input type="button" name="score" size="3" id=score value="0"></td>
<td height="36" width="66">
<p align="center"><input type="button" name="outof" size="3" id=outof value="0"></td>
</tr>
</table>
</body>
</html>
Any feedback would be much apprieciated...
View 6 Replies
View Related
Sep 25, 2006
I have been making a game in javascript. The game works now but I would like to know if the user has completed the game. Hope some one have an idea on how to find out if the user has completed the game. Code:
View 1 Replies
View Related
Feb 14, 2003
I am trying to get a line of text that a user types into a textfield to appear somewhere else on the screen. AT teh moment when the user presses submit it refreshes the page and does write the text line to the screen but it is a brand new page and I lose all my content.
View 11 Replies
View Related
Jul 20, 2005
Has anyone got a script to run a higher or lower card game on a web page.
View 1 Replies
View Related
Nov 18, 2009
I am trying to create a tic tac toe game using jQuery. In the game the player starts a game and when someone else does the same they can then play each other.
So far I am stuck for ideas as to how to construct the javascript. This is the javascript i have so far.
Code:
Should i use a plugin? I thought it would be easier..
View 2 Replies
View Related
Jan 4, 2010
How to empty one of the cells and identify the adjacent cells (the ones with which the empty cell could swap on the first move.) code...
View 4 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
Apr 26, 2010
I need a racing game in java graphics doesn't matter but speed should be good ?
View 2 Replies
View Related
Jun 25, 2011
I'm wanting to know how does the computer know whose scored more in a game?
View 1 Replies
View Related
Jul 12, 2009
i am in my efforts to perform a coding for a chess game between two persons who play with each other from different computer systems through internet. i want to know about how i can code in such a manner that when player 1 makes some move, player 2's chess board in his respective screen shows him the move of player 1 and vice versa. this has to happen without reloading the page.
View 5 Replies
View Related
Apr 15, 2011
how can i put choices in a guessing game. choices such as a,b, c, and d. And if the answer of the player is correct, the game will proceed to level 2, else game over.
View 1 Replies
View Related
May 22, 2007
I just need JavaScript to validate a form, and tell the person if h/she has answered the question correctly. For example; If the question was, what color is the sun? And h/she answered blue, then pressed the submit button. A text box would pop up explaining that h/she has answered incorectly. If h/she answeres yellow. Then on submit would send that person to the next page.
View 2 Replies
View Related
May 8, 2009
I am looking for code/library (free, commercial) which can take two images and create a spot the difference game using Javascript and/or flash.
View 2 Replies
View Related
Feb 28, 2009
I have a facebook game that I would like to create an autoroller for. What the game does is you get a base login and you click an object and you collect common, semi rare, and rares. I want the autoroller to take whatever money the user puts in a field and start rolling for those prizes. To give you an example [URL]. I have 3 scripts written already, 1 in html and 2 in java, but I don't know how to execute them.
View 1 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
Mar 21, 2010
I am trying to create an Asteroids type game using JavaScript along with html5's canvas element for drawing. I have searched around and have looked at examples but I can't figure out what is wrong with my rendering that I do in the game loop that is run every frame. The problem appears to be only that the canvas is not cleared at the beginning of each frame but I feel there might be something wrong also. The code used and shown below only works in Firefox but not Google Chrome or Safari.
[Code]...
View 2 Replies
View Related
Apr 4, 2010
what im trying to do is make a javascript pop-up message in real time alerting members who are online at that time to a game submitted i help run a fifa10 online league site and we are venturing into the 2v2 part of the site.
now when a player goes to the 2v2 page they are presented with a submit button to submit a 2v2 game to the system. then this already shows up on the pagebut what we are after is a little pop up box which after the game button is pressed to submit the game the pop-up shows to the whole site that a 2v2 game has been submitted for playing.
we want this so you dont have to sit on the 2v2 page to wait for a submitted game.
View 2 Replies
View Related
May 26, 2011
I'm in need to be able to create a matching picture game, in which I have rougly 9 images to be able to match, but 18 in total. I have started with a thought of having a button that; when pressed it will disappear and show the image that is within the function.
Progress; I am able to press the button and let the image load, but in this case everything goes fine (image resized, not sure about the id though) but the image doesn't show, it just shows an [X]
yet when I just put
<script language="Javascript" type="text/javascript">
function callImage(){
document.write("<img src="images/truck0.jpg">")
}
</script>
The function works fine when I press the button.
[Code]..
View 6 Replies
View Related