Dopo aver postato mi è venuto il dubbio che forse era meglio mettere il topic in Java 
comunque non so quanto potrebbe servire il codice java, a me sembra più un problema di html o browser, ma non son sicuro.
la classe Campo è la logica del gioco.
codice:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package eserciziotris;
/**
*
* @author vanonima
*/
public class Campo {
int grandezza;
boolean giocatore1 = true;
boolean finita = false;
int volteO = 0;
int volteX = 0;
Cella celle[][];
public Campo(int numLunghezza) {
grandezza = numLunghezza;
celle = new Cella[grandezza][grandezza];
creaPianoGioco();
}
public void creaPianoGioco() {
for (int i = 0; i < grandezza; i++) {
for (int j = 0; j < grandezza; j++) {
celle[i][j] = new Cella();
}
}
}
public boolean isOccupata(int x, int y) {
if (celle[x][y].occupata == true) {
return true;
} else {
return false;
}
}
public void inserisci(int x, int y) {
if (finita == false) {
if (isOccupata(x, y) == false) {
celle[x][y].occupata = true;
if (giocatore1 == true) {
celle[x][y].tipoX = true;
} else {
celle[x][y].tipoO = true;
}
cambiaGiocatore();
}
controllaPunteggio();
}
}
public void cambiaGiocatore() {
if (giocatore1 == true) {
giocatore1 = false;
} else {
giocatore1 = true;
}
}
public void controllaPunteggio() {
int zero = 0;
for (int i = 0; i < grandezza; i++) {
for (int j = 0; j < grandezza; j++) {
if (celle[zero][zero].tipoO == true && celle[zero + j][zero + j].tipoO == true) {
volteO++;
}
if (celle[zero][zero].tipoX == true && celle[zero + j][zero + j].tipoX == true) {
volteX++;
}
}
if (volteO == grandezza || volteX == grandezza) {
break;
} else {
volteO = 0;
volteX = 0;
}
for (int j = 0; j < grandezza; j++) {
if (celle[zero][i].tipoO == true && celle[zero + j][i].tipoO == true) {
volteO++;
}
if (celle[zero][i].tipoX == true && celle[zero + j][i].tipoX == true) {
volteX++;
}
}
if (volteO == grandezza || volteX == grandezza) {
break;
} else {
volteO = 0;
volteX = 0;
}
for (int j = 0; j < grandezza; j++) {
if (celle[i][zero].tipoO == true && celle[i][zero + j].tipoO == true) {
volteO++;
}
if (celle[i][zero].tipoX == true && celle[i][zero + j].tipoX == true) {
volteX++;
}
}
if (volteO == grandezza || volteX == grandezza) {
break;
} else {
volteO = 0;
volteX = 0;
}
for (int j = 0; j < grandezza; j++) {
if (celle[zero][grandezza - 1].tipoO == true && celle[j][(grandezza - 1) - j].tipoO == true) {
volteO++;
}
if (celle[zero][grandezza - 1].tipoX == true && celle[j][(grandezza - 1) - j].tipoX == true) {
volteX++;
}
if ((volteX < grandezza && j == grandezza - 1) && (volteO < grandezza && j == grandezza - 1)) {
volteO = 0;
volteX = 0;
}
}
}
if (volteO == grandezza) {
finita = true;
}
if (volteX == grandezza) {
finita = true;
}
}
}
la classe Cella è per gli array bidimensionali e rapresenta, ovviamente, una cella.
codice:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package eserciziotris;
/**
*
* @author vanonima
*/
public class Cella {
boolean occupata = false;
boolean tipoX = false;
boolean tipoO = false;
public boolean isVuota() {
if (occupata == false) {
return true;
} else {
return false;
}
}
public boolean isTipoX() {
if (tipoX == false) {
return false;
} else {
return true;
}
}
public boolean isTipoO() {
if (tipoO == false) {
return false;
} else {
return true;
}
}
}
La classe Grafica è la classe per, anche qui è ovvio, la grafica, estende la JApplet
codice:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package eserciziotris;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
/**
*
* @author vanonima
*/
public class Grafica extends JApplet {
Campo c = new Campo(3);
JToggleButton[][] btn = new JToggleButton[c.grandezza][c.grandezza];
GridLayout grid = new GridLayout(c.grandezza, c.grandezza);
JPanel pan = new JPanel();
public Grafica() {
for (int i = 0; i < c.grandezza; i++) {
for (int j = 0; j < c.grandezza; j++) {
btn[i][j] = new JToggleButton();
btn[i][j].setBackground(new Color(238, 238, 238));
btn[i][j].addMouseListener(new bottoneCliccato());
pan.add(btn[i][j]);
}
}
pan.setLayout(grid);
getContentPane().add(pan);
inserisci();
setSize(300, 300);
}
public void inserisci() {
c.creaPianoGioco();
}
private class bottoneCliccato implements MouseListener {
public void mouseClicked(MouseEvent e) {
for (int i = 0; i < c.grandezza; i++) {
for (int j = 0; j < c.grandezza; j++) {
if (c.giocatore1 == true) {
if (btn[i][j].isSelected() == true) {
btn[i][j].setText("X");
btn[i][j].setSelected(false);
c.celle[i][j].occupata = true;
c.celle[i][j].tipoX = true;
c.cambiaGiocatore();
c.controllaPunteggio();
btn[i][j].setEnabled(false);
finita();
}
} else {
if (btn[i][j].isSelected() == true) {
btn[i][j].setText("O");
c.cambiaGiocatore();
c.celle[i][j].occupata = true;
c.celle[i][j].tipoO = true;
btn[i][j].setSelected(false);
c.controllaPunteggio();
btn[i][j].setEnabled(false);
finita();
}
}
}
}
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
}
public void finita() {
if (c.finita == true) {
for (int i = 0; i < c.grandezza; i++) {
for (int j = 0; j < c.grandezza; j++) {
btn[i][j].setEnabled(false);
}
}
if (c.volteO > c.volteX) {
JOptionPane.showMessageDialog(null, "Giocatore 2 hai Vinto!");
} else {
JOptionPane.showMessageDialog(null, "Giocatore 1 hai Vinto!");
}
}
}
}