Thanks in advance.
Here is the code :
function init_image()
{
var url = "/image/";
// var url = "./";
pieces[ 0]="SQUARE.png";
pieces[ 1]="NPAWN.png";
pieces[ 2]="NFPAWN.png";
pieces[ 3]="NQUEEN.png";
pieces[ 4]="NKNIGHT.png";
pieces[ 5]="NBISHOP.png";
pieces[ 6]="NROOK.png";
pieces[ 7]="NKING.png";
pieces[ 8]="SPAWN.png";
pieces[ 9]="SFPAWN.png";
pieces[10]="SQUEEN.png";
pieces[11]="SKNIGHT.png";
pieces[12]="SBISHOP.png";
pieces[13]="SROOK.png";
pieces[14]="SKING.png";
pieces[15]="WPAWN.png";
pieces[16]="WFPAWN.png";
pieces[17]="WQUEEN.png";
pieces[18]="WKNIGHT.png";
pieces[19]="WBISHOP.png";
pieces[20]="WROOK.png";
pieces[21]="WKING.png";
pieces[22]="EPAWN.png";
pieces[23]="EFPAWN.png";
pieces[24]="EQUEEN.png";
pieces[25]="EKNIGHT.png";
pieces[26]="EBISHOP.png";
pieces[27]="EROOK.png";
pieces[28]="EKING.png";
for (var i=0; i<pieces.length; i++)
{
pieces[i] = url + pieces[i];
// alert(i+' '+ pieces.length+' '+pieces[i]);
}
}
function display_board()
{
var i=8;
var j=0;
var k=0;
var v=0;
var r,x,y;
for (y=0;y<=YMAX;y++)
{
for (x=1;x<=XMAX;x++)
{
r=document.getElementById('my_table').rows[y].cells;
v=my_board[x-1][YMAX-y-1];
if (v>=0)
{
while (r[x].childNodes.length > 0)
r[x].removeChild(r[x].childNodes[0]);
var spanNode = document.createElement('img');
spanNode.src=pieces[v];
// alert(pieces[v]);
spanNode.width=wl;
spanNode.height=wl;
r[x].appendChild(spanNode);
}
}
}
}
var url = "image/";
--
Trevor Lawrence
Canberra
Web Site http://trevorl.mvps.org
"Solang" <sol...@verizon.net> wrote in message
news:OE4LmZoW...@TK2MSFTNGP02.phx.gbl...
The reason I want to put all those png file under /image is to
allow multiple pages to access them such as :
http://mysite.verizon.net/solang
http://mysite.verizon.net/solang/work
So, the /image/ doesn't work like before(many years ago).
I spend a few hours playing with this issue and find a partial solution
by using this :
function init_image()
{
var url = "http://mysite.verizon.net/solang/image/";
..
}
I have two web site and another one is http://jinpusa.angelfire.com/
function init_image()
{
var url = "http://jinpusa.angelfire.com/image/";
}
This angelfire is very stubborn and no matter what I've tried, it just
doesn't work.
Howver, when I ftp the file, it gave me a warning that this html file has
only linefeed
and no carriage return.
I still like to use "/ " as top level directory.
Thanks.
"Trevor Lawrence" <Trevor L.@Canberra> wrote in message
news:u7fxPDqW...@TK2MSFTNGP02.phx.gbl...
For both http://mysite.verizon.net/solang and
http://mysite.verizon.net/solang/work, are they on
http://mysite.verizon.net/image
If so, I assume you have files such as
http://mysite.verizon.net/solang/index.html which want to access images such
as http://mysite.verizon.net/image/image1.png
In ths case the reference would be "../image/image1.png"
"../" moves up one level (to http://mysite.verizon.net/)
"image/" moves to the image directory (i.e.http://mysite.verizon.net/image/)
"image1.png" adds the filename
But if you are in http://mysite.verizon.net/solang/work/index.html and want
to access images such as http://mysite.verizon.net/image/image1.png, you
would have to use
"../../image/image1.png"
That is you need to move up two levels to get to http://mysite.verizon.net/
. Then you go down the structure to get to "image/image1.png" as before
Reference:
http://www.webdevelopersnotes.com/design/relative_and_absolute_urls.php3
You may find it easier to use absolute urls, as in your example
--
Trevor Lawrence
Canberra
Web Site http://trevorl.mvps.org
"Solang" <sol...@verizon.net> wrote in message
news:%23B5e68v...@TK2MSFTNGP06.phx.gbl...
The reason that I want to use "/image/" is to avoid modifying board1.html.
Using
absolute(var url = "http://mysite.verizon.net/solang/image/") or
relative(var url="../image/";)
will require changing board1.html. Here is the list of the files that are
required for a given page:
index.html
move.html
music.html
board1.html
IsThere.class
and those image(.png) file and two mp3 files.
Theese files were uploaded to the web by my C++ application using ftp SDK.
The only file that was generated by the C++ is move.html that put PGN file
into listboxes.
If I can not use var url="/image/", then I have to write a small function in
my C++
application to modify the board1.html.
BTW, in the old JScript API, isn't "/" an equivalent to the topmost dir?
"Trevor Lawrence" <Trevor L.@Canberra> wrote in message
news:O7eU8o1W...@TK2MSFTNGP02.phx.gbl...
I have tested this on my website, using IE7.
In the file http://tandcl.homemail.com.au/caroles_stories/abraham_part1.html
,
I added the code
<a href="/siteinfo.html">Test </a>
and clicking on Test opened http://tandcl.homemail.com.au/siteinfo.html
So if "image" is a directory on the root, i.e.
http://mysite.verizon.net/image
and the file to be opened is http://mysite.verizon.net/image/SQUARE.png
this should write code which when clicked will locate to it from anywhere
var url="/image/";
var newurl = url + "SQUARE.png";
document.write("<a href='" + newurl + "'>Click to open me</a>");
--
Trevor Lawrence
Canberra
Web Site http://trevorl.mvps.org
"Solang" <sol...@verizon.net> wrote in message
news:%23ScKra7...@TK2MSFTNGP05.phx.gbl...