N
New to Script Languages
Hi,
For the past two weeks, I am learning HTML and Javascript to
complete a task. My task is to write a Java script to redisplay
a chess game recorded in KPGN format(modified PGN).
So far, the layout of the page is complete and all I need is to
put the code to it. I divide the page into 4 frames.
Frame 1 is for playing songs using embed.
BTW, is it possible to repeat playing the songs until
the user psuh stop button?
Now, it plays until the end and stop.
Frame 2 is used to store the KPGN in combo box
Is it necessary to put id tag for every element?
Frame 3 is for user interaction(run, step, stop etc...)
<input type="button" value="<<" onclick="beg_kpgn()">
<input type="button" value="<" onclick="step_kpgn(-1)">
<input type="button" value="Run" onclick="run_kpgn()">
<input type="button" value="Stop" onclick="stop_kpgn()">
<input type="button" value=">" onclick="step_kpgn(1)">
<input type="button" value=">>" onclick="end_kpgn()">
Frame 4 is for displaying the board. I am using table 8x8 or 14x14
depending on the number of player;
Here is what I am not sure how to complete the code.
1. I am only familiar with Combo box in MS C for Window.
How can I index and retrieve the data from the Combo Box?
The code will be in Frame 2 and the Combo box is in Frame 2.
How will this code access to the Combo Box?
2. Right now, I put id on every cell to ease the code in accessing the
cell. The pieces are stored in array board[8][8].
How can I put an image to a cell?
Thanks.
======= index.html ===================
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1"><title>Internet Khmer Chess</title>
<script type="text/javascript">
var intval=""
function start_Int()
{
if (intval=="")
{
intval=window.setInterval("start_clock()",1000)
} else
{
stop_Int()
}
}
function stop_Int()
{
if (intval!="")
{
window.clearInterval(intval)
intval=""
myTimer.innerHTML="Interval Stopped"
}
}
function start_clock()
{
var d=new Date()
var sw="am"
var h=d.getHours()
var m=d.getMinutes() + ""
var s=d.getSeconds() + ""
if (h>12)
{
h-=12
sw="pm"
}
if (m.length==1)
{
m="0" + m
}
if (s.length==1)
{
s="0" + s
}
myTimer.innerHTML=h + ":" + m + ":" + s + " " + sw
}
</script>
<FRAMESET COLS="38%,62%">
<FRAMESET ROWS="25%,60%,15%">
<FRAME NAME="frame1" src="music.HTML">
<FRAME NAME="frame2" src="move.HTML">
<FRAME NAME="frame3" src="action.HTML">
</FRAMESET>
<FRAME NAME="frame4" src="board1.HTML">
</FRAMESET>
<p></html>
For the past two weeks, I am learning HTML and Javascript to
complete a task. My task is to write a Java script to redisplay
a chess game recorded in KPGN format(modified PGN).
So far, the layout of the page is complete and all I need is to
put the code to it. I divide the page into 4 frames.
Frame 1 is for playing songs using embed.
BTW, is it possible to repeat playing the songs until
the user psuh stop button?
Now, it plays until the end and stop.
Frame 2 is used to store the KPGN in combo box
Is it necessary to put id tag for every element?
Frame 3 is for user interaction(run, step, stop etc...)
<input type="button" value="<<" onclick="beg_kpgn()">
<input type="button" value="<" onclick="step_kpgn(-1)">
<input type="button" value="Run" onclick="run_kpgn()">
<input type="button" value="Stop" onclick="stop_kpgn()">
<input type="button" value=">" onclick="step_kpgn(1)">
<input type="button" value=">>" onclick="end_kpgn()">
Frame 4 is for displaying the board. I am using table 8x8 or 14x14
depending on the number of player;
Here is what I am not sure how to complete the code.
1. I am only familiar with Combo box in MS C for Window.
How can I index and retrieve the data from the Combo Box?
The code will be in Frame 2 and the Combo box is in Frame 2.
How will this code access to the Combo Box?
2. Right now, I put id on every cell to ease the code in accessing the
cell. The pieces are stored in array board[8][8].
How can I put an image to a cell?
Thanks.
======= index.html ===================
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1"><title>Internet Khmer Chess</title>
<script type="text/javascript">
var intval=""
function start_Int()
{
if (intval=="")
{
intval=window.setInterval("start_clock()",1000)
} else
{
stop_Int()
}
}
function stop_Int()
{
if (intval!="")
{
window.clearInterval(intval)
intval=""
myTimer.innerHTML="Interval Stopped"
}
}
function start_clock()
{
var d=new Date()
var sw="am"
var h=d.getHours()
var m=d.getMinutes() + ""
var s=d.getSeconds() + ""
if (h>12)
{
h-=12
sw="pm"
}
if (m.length==1)
{
m="0" + m
}
if (s.length==1)
{
s="0" + s
}
myTimer.innerHTML=h + ":" + m + ":" + s + " " + sw
}
</script>
<FRAMESET COLS="38%,62%">
<FRAMESET ROWS="25%,60%,15%">
<FRAME NAME="frame1" src="music.HTML">
<FRAME NAME="frame2" src="move.HTML">
<FRAME NAME="frame3" src="action.HTML">
</FRAMESET>
<FRAME NAME="frame4" src="board1.HTML">
</FRAMESET>
<p></html>