Simply Sudoku

Ask questions about projects relating to: computer science or pure mathematics (such as probability, statistics, geometry, etc...).

Moderators: AmyCowen, kgudger, bfinio, MadelineB, Moderators

RCInsider
Posts: 9
Joined: Wed Nov 18, 2009 5:25 pm
Occupation: Student: 8th Grade
Project Question: Can You Check & Then Solve A Sudoku Problem Using JavaScript?
Project Due Date: January 26, 2010
Project Status: I am conducting my research

Simply Sudoku

Post by RCInsider »

For my project, I will be using the Science Buddies' Program To Check A Sudoku Problem with slight modifications.

I am familiar with HTML, but not JavaScript. I need help with the following:

-Making the interface of the program look sleeker than just a simple gray and white

-Entrance logo while program loads

-Capability of not having to be a website supported program

-Lastly, ability to solve a Sudoku problem with JavaScript.

If anyone is experienced with JavaScript or program designing, please help!
rgoelmsft
Former Expert
Posts: 25
Joined: Fri Oct 23, 2009 2:31 pm
Occupation: Software Engineer
Project Question: n/a
Project Due Date: n/a
Project Status: Not applicable

Re: Simply Sudoku

Post by rgoelmsft »

Hello there,

This sounds like a fun project. It will be impossible for me to teach you Javascript through these forums, so I would strongly recommend you get a book. Visit the computer programming or website development section of any bookstore, and you will find many books on Javascript. I have one called "Javascript & Ajax, Sixth Edition, Visual Quickstart Guide". I wanted to respond to a few of your points:
-Making the interface of the program look sleeker than just a simple gray and white
You don't need Javascript for this. Simply by modifying your HTML, you can add full color to your program, and make it look as sleek as you want. For you, I would recommend designing the look and visuals of the application on paper first, and then try to code it up in HTML. Once you know what you want it to look like, see if you can post an image of it (even if it's just a photo of your drawing on paper), and I can help you figure out the HTML.
-Entrance logo while program loads
I would advise against this. It's a lot of work and for not much gain. This is because I'm certain your website will load very quickly, since you're only using Javascript and HTML.
-Capability of not having to be a website supported program
Can you explain? You want to write a program that both works from a website as well as a standalone application? Why? I would focus on building just the web application. If your goal is for someone to be able to run the application without an internet connection, then that should still be possible simply by saving all the HTML and Javascript files locally to disk, and then pointing your web browser at your local copy. Let me know if you need further help with this.
-Lastly, ability to solve a Sudoku problem with JavaScript.
This is really the heart of your science project, and I can't simply write the code for you. You'll need to think about the algorithm first, and write it down in pseudocode. Once you have an idea of how you want to solve this problem, I can help you with translating it into Javascript.

Also, can you tell me ... are you familiar with any computer programming languages? If you do have experience with other languages, then I may be able to point you in a direction that takes advantage of your existing knowledge, rather than having to learn a new language for this project.

--Rajeev
RCInsider
Posts: 9
Joined: Wed Nov 18, 2009 5:25 pm
Occupation: Student: 8th Grade
Project Question: Can You Check & Then Solve A Sudoku Problem Using JavaScript?
Project Due Date: January 26, 2010
Project Status: I am conducting my research

Re: Simply Sudoku

Post by RCInsider »

Thanks! The only computer language I am familiar with is HTML and some CSS codes.

I will be sure to look around for help on Javascript. I have a long flight to Hawaii coming up, so that might be a good time to get a good book and read about JavaScript. :)
RCInsider
Posts: 9
Joined: Wed Nov 18, 2009 5:25 pm
Occupation: Student: 8th Grade
Project Question: Can You Check & Then Solve A Sudoku Problem Using JavaScript?
Project Due Date: January 26, 2010
Project Status: I am conducting my research

Re: Simply Sudoku

Post by RCInsider »

Okay I have a bit of understanding of the alorithms, but time is wearing down bringing me behind schedule. I need the most help with turning the algorithms into JavaScript code, so if anyone can help, I would most greatly apreciate it!
rgoelmsft
Former Expert
Posts: 25
Joined: Fri Oct 23, 2009 2:31 pm
Occupation: Software Engineer
Project Question: n/a
Project Due Date: n/a
Project Status: Not applicable

Re: Simply Sudoku

Post by rgoelmsft »

Hi again --

I can't write all of your Javascript for you, but if you post an example of something specific that you're trying to accomplish (e.g., a specific part of your algorithm), I can help you get started with the Javascript.

--Rajeev
amyc
Site Admin
Posts: 1130
Joined: Mon Dec 15, 2008 3:38 pm
Occupation: Science Buddies
Project Question: N/A
Project Due Date: N/A
Project Status: Not applicable

Re: Simply Sudoku

Post by amyc »

RCInsider - Much of the JavaScript you'll need to work with the project is provided, but you will be writing your own functions and code to test to see if the solution is valid. As Rajeev has noted, if you have specific questions (specific places where your code is not working or where you need help thinking through the strategy and thinking behind the code you need to write), this is the perfect place to get help. You need to have concrete questions, however, and you want to be able to paste in portions of your code that the Experts can see and look over. The Experts can't write the code for you. That's the science project you're doing!

This looks like a fun project. I hope you have some time to get it underway.

Amy
Science Buddies
RCInsider
Posts: 9
Joined: Wed Nov 18, 2009 5:25 pm
Occupation: Student: 8th Grade
Project Question: Can You Check & Then Solve A Sudoku Problem Using JavaScript?
Project Due Date: January 26, 2010
Project Status: I am conducting my research

Re: Simply Sudoku

Post by RCInsider »

Well, that is what the science project started out as, but as time continues to dwindle down with little progress the project is begin to turn into more of something where I learn about the algorithms behind Sudkou problems, make a code based on that information, and then get help as far as seeing how that can transform into a JAvaScript code. If that does not happen within these next two or three weeks, I will simply be testing whether these programs others have made work correctly. Time seems to suck all of the good out of my projects but I sure hope I get to where I want to go with this project.
RCInsider
Posts: 9
Joined: Wed Nov 18, 2009 5:25 pm
Occupation: Student: 8th Grade
Project Question: Can You Check & Then Solve A Sudoku Problem Using JavaScript?
Project Due Date: January 26, 2010
Project Status: I am conducting my research

Re: Simply Sudoku

Post by RCInsider »

Okay, so I found these three codes on this site. I am wondering if any of these are already in JavaScript or if tthey aren't, which is closest to and most easily transferable in to JavaScript?

http://en.wikipedia.org/wiki/Algorithmics_of_sudoku
rgoelmsft
Former Expert
Posts: 25
Joined: Fri Oct 23, 2009 2:31 pm
Occupation: Software Engineer
Project Question: n/a
Project Due Date: n/a
Project Status: Not applicable

Re: Simply Sudoku

Post by rgoelmsft »

In the Wikipedia article you linked to, the language of the code is mentioned right above the code. The first code snippet is written in Java, the next in Ruby, then C, and finally Prolog. Of these four pieces of code, the one that is closest to Javascript would be Java. The next closest would be C.
RCInsider
Posts: 9
Joined: Wed Nov 18, 2009 5:25 pm
Occupation: Student: 8th Grade
Project Question: Can You Check & Then Solve A Sudoku Problem Using JavaScript?
Project Due Date: January 26, 2010
Project Status: I am conducting my research

Re: Simply Sudoku

Post by RCInsider »

Is that Java code just a piece of the code needed? So far I am working on just the problem checker for starters listed on the site which I will most likely be using since I need testing done tomorrow unless I can have a JavaScript set up by tonight.
rgoelmsft
Former Expert
Posts: 25
Joined: Fri Oct 23, 2009 2:31 pm
Occupation: Software Engineer
Project Question: n/a
Project Due Date: n/a
Project Status: Not applicable

Re: Simply Sudoku

Post by rgoelmsft »

It's hard for me to figure out what you're referring to, since you're not being very specific. Are you still talking about the code listed on the following Wikipedia article?:

http://en.wikipedia.org/wiki/Algorithmics_of_sudoku

There are a few lines of Java code listed on the site. Is this what you're referring to?:

Code: Select all

final int n = 3;
final int[][] field = new int[n*n][n*n];
int x = 0;
for(int i = 0; i < n; i++, x++)
	for(int j = 0; j < n; j++, x+=n)
		for(int k = 0; k < n*n; k++, x++)
			field[n*i+j][k] = (x % (n*n)) + 1;
The description of what this code does is written right there on the Wikipedia page. It says "The above procedure produces the following 9x9 sudoku:"

+-----------------------+
| 1 2 3 | 4 5 6 | 7 8 9 |
| 4 5 6 | 7 8 9 | 1 2 3 |
| 7 8 9 | 1 2 3 | 4 5 6 |
|-------+-------+-------|
| 2 3 4 | 5 6 7 | 8 9 1 |
| 5 6 7 | 8 9 1 | 2 3 4 |
| 8 9 1 | 2 3 4 | 5 6 7 |
|-------+-------+-------|
| 3 4 5 | 6 7 8 | 9 1 2 |
| 6 7 8 | 9 1 2 | 3 4 5 |
| 9 1 2 | 3 4 5 | 6 7 8 |
+-----------------------+

So, no, this code is not a "problem checker". To write a problem checker, you need to take as input a 9x9 array. Then you simply need to write code to loop through every row, column, and 3x3 square, to make sure that every number 1-9 is represented exactly once.

--Rajeev
RCInsider
Posts: 9
Joined: Wed Nov 18, 2009 5:25 pm
Occupation: Student: 8th Grade
Project Question: Can You Check & Then Solve A Sudoku Problem Using JavaScript?
Project Due Date: January 26, 2010
Project Status: I am conducting my research

Re: Simply Sudoku

Post by RCInsider »

^ Thank you, but my time has been cut short to four more days. So, now just sticking to the original plan, I am making a program that more simply checks problems.

So I have gotten pretty far on that, but I am having trouble with the first couple buttons. They appear as text instead as being read as JavaScript. Here is that piece of the code:

Code: Select all

<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -

var puzzle = new Array(9);

for (i=0; i < 9; i++)
   puzzle[i]=new Array(9);
// reads values from the Sudoku form, stores them in the puzzle[][] array, 
// and writes them to the OutputText TEXTAREAfunction ReadCells()
{
   var cell;

   document.getElementById('OutputText').value = "ReadCells():\n";
   for(i = 1; i <= 9; i++){
      for(j = 1; j <= 9; j++){
         cell = "C" + i + "_" + j;
         puzzle[i-1][j-1] = document.getElementById(cell).value;
      }
      document.getElementById('OutputText').value += puzzle[i-1].join(" ");
      document.getElementById('OutputText').value += "\n";
   }
}

// - End of JavaScript - -->
</SCRIPT>
Any help?

Also, I had accidentally come across this program in my school computer class that showed the HTML and CSS
behind whichever website I was on, but unfortunately, I could not find out what it was. Ay ideas on that too?
rgoelmsft
Former Expert
Posts: 25
Joined: Fri Oct 23, 2009 2:31 pm
Occupation: Software Engineer
Project Question: n/a
Project Due Date: n/a
Project Status: Not applicable

Re: Simply Sudoku

Post by rgoelmsft »

I tried the piece of Javascript that you posted, and with some minor changes, it is actually working fine for me. Did you write this yourself? If so, nice work.

I did have to make a couple of minor changes ... firstly, everywhere that you have ".value", I changed it to ".innerHtml". Secondly, in the two places where you have "\n", I changed it to "<br/>". With these changes, the code was able to correctly read the data out of the sudoku grid, and print out the values. If this is not working for you, perhaps the problem is somewhere else within your HTML. If so, you may need to post the entire thing, not just the Javascript.

As far as finding out the HTML for any web page, I typically just use the Page --> View Source function in my web browser. If you are using Firefox, then there is a free download called Firebug which may help you.

--Rajeev
RCInsider
Posts: 9
Joined: Wed Nov 18, 2009 5:25 pm
Occupation: Student: 8th Grade
Project Question: Can You Check & Then Solve A Sudoku Problem Using JavaScript?
Project Due Date: January 26, 2010
Project Status: I am conducting my research

Re: Simply Sudoku

Post by RCInsider »

Wow, thanks! Pieces of the JavaScript are not mine, but I did write some of it. I will try those
to see what happens. I tried something else and got the buttons up which still did not do any action.

But I will try your advice.

Thanks and wish me good luck as tomorrow is Science Fair!

EDIT: Here is my new code. I tried the code from the actual Science Buddies site, and the buttons appear,
but they don't work!

Code: Select all

<HTML>
<HEAD>
<CENTER>
<img src="http://img704.imageshack.us/img704/4291/simplysudoku.jpg" width="800" height="434" border="0" />
<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="8">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="2">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="3">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="7">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="1">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="5">
<BR>

<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="8">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="5">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<BR>

<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="6">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="2">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<BR>

<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="3">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="5">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="7">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="6">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="4">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<BR>

<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="4">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="6">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<BR>

<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="4">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="7">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="8">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="1">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="3">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<BR>

<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="8">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="9">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<BR>

<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="2">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="3">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="">
<BR>

<FORM NAME="Sudoku" METHOD="post">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_1" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="9">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_2" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="1">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_3" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="2">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_4" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_5" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_6" STYLE="BACKGROUND-COLOR:BLUE;" VALUE="">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_7" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="3">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_8" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="5">
<INPUT TYPE="TEXT" maxLength="1" SIZE="1" ID="C1_9" STYLE="BACKGROUND-COLOR:GREEN;" VALUE="7">
<BR>
<BR>
<INPUT TYPE="button" VALUE="Read Cells" NAME="ReadCellsButton" onClick="ReadCells()">
<INPUT TYPE="button" VALUE="Restore Cells" NAME="RestoreCellsButton" onClick="RestoreCells()">
<INPUT TYPE="button" VALUE="Clear Puzzle" NAME="ClearButton1" onClick="ClearPuzzle()">
<INPUT TYPE="button" VALUE="Clear Text Area" NAME="ClearButton2" onClick="ClearTextArea()"><BR>
<TEXTAREA ID="OutputText" ROWS="10" cols="80" READONLY></TEXTAREA >
 
</FORM>


</CENTER>
rgoelmsft
Former Expert
Posts: 25
Joined: Fri Oct 23, 2009 2:31 pm
Occupation: Software Engineer
Project Question: n/a
Project Due Date: n/a
Project Status: Not applicable

Re: Simply Sudoku

Post by rgoelmsft »

The buttons don't do anything because there is no Javascript anywhere to tell it what to do! At the bottom of the HTML you posted, you see this:

<INPUT TYPE="button" VALUE="Read Cells" NAME="ReadCellsButton" onClick="ReadCells()">
<INPUT TYPE="button" VALUE="Restore Cells" NAME="RestoreCellsButton" onClick="RestoreCells()">
<INPUT TYPE="button" VALUE="Clear Puzzle" NAME="ClearButton1" onClick="ClearPuzzle()">
<INPUT TYPE="button" VALUE="Clear Text Area" NAME="ClearButton2" onClick="ClearTextArea()"><BR>

The browser is expecting to find some Javascript functions named ReadCells(), RestoreCells(), ClearPuzzle(), and ClearTextArea(). But those Javascript functions don't exist at all in the HTML that you pasted. So the buttons don't do anything.
Locked

Return to “Grades 6-8: Math and Computer Science”