1)A html file, can be named anything (index.html in my case).
2)A css file with name of your choice (style.css in my case).
3)A Javascript file with name of your choice (jscript.js in mycase).
4)A Plist file named info.plist where you save the application information.
If you need an icon for your application create one and name it icon.png or with whatever extension
The index.html code :
<html>
<head>
<title>Tic Tac Toe</title>
<script language="javascript" type="text/javascript" src="jscript.js"></script>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<div id="row1"><button id="1" onclick="change(this)">?</button><button id="2" onclick="change(this)">?</button><button id="3" onclick="change(this)">?</button></div>
<div id="row2"><button id="4" onclick="change(this)">?</button><button id="5" onclick="change(this)">?</button><button id="6" onclick="change(this)">?</button></div>
<div id="row3"><button id="7" onclick="change(this)">?</button><button id="8" onclick="change(this)">?</button><button id="9" onclick="change(this)">?</button></div>
<div id="row4"><label id="label">Turn : Player1</label></div>
<button onclick="reset()">Reset</button>
</body>
</html>
The style.css code :
button{
height:50px;
width:50px;
}
The jscript.js code :
Array.prototype.contains = function(obj) {
var i = this.length;
while (i--) {
if (this[i] === obj) {
return true;
}
}
return false;
}
var win= new Array(new Array('1','2','3'),new Array('4','5','6'),new Array('7','8','9'),new Array('1','4','7'),new Array('2','5','8'),new Array('3','6','9'),new Array('1','5','9'),new Array('3','5','7'));
var arrx = new Array();
var arro = new Array();
var count=0,xcount=0,ocount=0,won=0;
function change(button){
if(count%2==0){
button.innerHTML="X";
arrx[xcount]=button.id;
button.disabled=true;
document.getElementById("label").innerHTML="Turn : Player 2";
count++;
xcount++;
if(xcount>=3){
for(var i=0;i<8 arro="" arrx.contains="" button.disabled="true;" button.id="" button.innerhtml="O" count="" document.getelementbyid="" else="" i="" if="" innerhtml="Turn : Player 1" label="" ocount="" stop="" win="" won="1;">=3){
for(var i=0;i<8 array="" arro.contains="" arro="new" arrx="new" code="" count="0;" disabled="false;" document.getelementbyid="" function="" i="" if="" innerhtml="?" label="" ocount="0;" reset="" stop="" win="" won="0;" xcount="0;">8>8>
The style.css code :
DisplayName
TicTacToe
Identifier
in.co.presentsoft.tictactoe
Version
1.0
MainHTML
index.html
MiniViewEnabled
-->
Note : MainHTML entry should contain the html file name as is within the 'string' tag, and DisplayName should be same as the application name and folder that you created.
The Icon :
The application can be tested by opening the html file in a web browser.
Creating the installation package :
Just add the folder with all these files to a zip archive with same name (application name), next rename the zip file extension to '.wgz' and your package is ready.
Download my package here
No comments:
Post a Comment