<a href ...> not working

T

Trevor Lawrence

I have a button with an <a> tag which works on the web, but not locally

It is:
<a href="../" target="_parent"> <img style="border: none;"
src="res/up.gif"
onmouseover="this.src=up1.src" onmouseout="this.src=up0.src" width="31"
height="31" title="Up one level" id="up" alt="" /></a>

The code is generated by JAlbum - see
http://trevorl.mvps.org/ratec/AEC buses/album/index.html

When the button up1.src is clicked, it redirects to index.html on the next
level up, i.e. http://trevorl.mvps.org/ratec/AEC buses/index.html - as it
should.

But this same code DOES NOT work on my local disk copy. (By doesn't work, I
mean nothing happens at all)

Why is it so?

Isn't the reference the same whether on the web or local, i.e to index.html
on the next level up?
On the web, mousing over the button shows
http://trevorl.mvps.org/ratec/AEC buses/ in the status bar
On local disk, it shows:
file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Webs/mvpweb/ratec/AEC%20Buses/

Aren't these both a reference to the same file, i.e.
"ratec/AEC%20Buses/index.html" (which exists both locally and on the web)?
(I note some differences in capitalisation of "Buses" but I have checked in
FrontPage and the capitalisation of the folder name exists on the website,
although some internal references may still be lower case. Anyway, the code
in http://trevorl.mvps.org/ratec/Memorabilia/ does the same and there is no
possibility of a capitalisation problem here - it is and was always
capitalised)

Could the function keypress() somehow be working differently when on the web
and not on the web ?


CODE EXTRACT
<head>
<!-- saved from url=(0013)about:internet -->
<title>AEC Buses</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="Keywords" content="photo,album,gallery,AEC Buses" />

<script type="text/javascript">
/* <![CDATA[ */
function keypress(e) {
if(!e) var e = window.event;
if(e.keyCode) keyCode = e.keyCode;
else if(e.which) keyCode = e.which;
switch(keyCode) {
case 8: window.location="../"; return false; break;
case 63273: case 36: window.location="index.html"; return false; break;
case 63275: case 35: window.location="index.html"; return false; break;
case 13: window.location="slides/01 AEC Regal 1927
interior.html?show_param=3"; break;
}
return true;
}
function keypresslistener() {
if(document.all) document.onkeydown = keypress;
else if(document.layers || document.getElementById) document.onkeypress =
keypress;
}
up0 = new Image(31,31); up0.src = "res/up.gif";
up1 = new Image(31,31); up1.src = "res/up1.gif";
next0 = new Image(31,31);next0.src = "res/next.gif";
next1 = new Image(31,31);next1.src = "res/next1.gif";
prev0 = new Image(31,31);prev0.src = "res/prev.gif";
prev1 = new Image(31,31);prev1.src = "res/prev1.gif";
/* ]]> */
</script>
<link rel="stylesheet" type="text/css" href="res/styles.css" />
<style type="text/css">
body { background-image: url(res/bg.gif); background-repeat: repeat-x; }
</style>
</head>

<body id="body" onload="keypresslistener();">
<div style="width:99%; margin-left:auto; margin-right:auto;
text-align:center;">
<table style="height:54px;" align="center" cellspacing="0" cellpadding="0"
border="0">
<tr><td>
<!-- Header of index pages -->
<table style="width:722px;" cellspacing="0" cellpadding="0" border="0">
<tr>
<td style="width:31px;">
<a href="../" target="_parent">
<img style="border: none;" src="res/up.gif"
onmouseover="this.src=up1.src" onmouseout="this.src=up0.src" width="31"
height="31" title="Up one level" id="up" alt="" /></a></td>

END OF CODE EXTRACT
 
T

Thomas A. Rowe

No it is not the same locally, unless you are running IIS.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================


Trevor Lawrence said:
I have a button with an <a> tag which works on the web, but not locally

It is:
<a href="../" target="_parent"> <img style="border: none;" src="res/up.gif"
onmouseover="this.src=up1.src" onmouseout="this.src=up0.src" width="31"
height="31" title="Up one level" id="up" alt="" /></a>

The code is generated by JAlbum - see http://trevorl.mvps.org/ratec/AEC buses/album/index.html

When the button up1.src is clicked, it redirects to index.html on the next level up, i.e.
http://trevorl.mvps.org/ratec/AEC buses/index.html - as it should.

But this same code DOES NOT work on my local disk copy. (By doesn't work, I mean nothing happens
at all)

Why is it so?

Isn't the reference the same whether on the web or local, i.e to index.html on the next level up?
On the web, mousing over the button shows http://trevorl.mvps.org/ratec/AEC buses/ in the status
bar
On local disk, it shows:
file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Webs/mvpweb/ratec/AEC%20Buses/

Aren't these both a reference to the same file, i.e. "ratec/AEC%20Buses/index.html" (which exists
both locally and on the web)?
(I note some differences in capitalisation of "Buses" but I have checked in FrontPage and the
capitalisation of the folder name exists on the website, although some internal references may
still be lower case. Anyway, the code in http://trevorl.mvps.org/ratec/Memorabilia/ does the same
and there is no possibility of a capitalisation problem here - it is and was always capitalised)

Could the function keypress() somehow be working differently when on the web and not on the web ?


CODE EXTRACT
<head>
<!-- saved from url=(0013)about:internet -->
<title>AEC Buses</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="Keywords" content="photo,album,gallery,AEC Buses" />

<script type="text/javascript">
/* <![CDATA[ */
function keypress(e) {
if(!e) var e = window.event;
if(e.keyCode) keyCode = e.keyCode;
else if(e.which) keyCode = e.which;
switch(keyCode) {
case 8: window.location="../"; return false; break;
case 63273: case 36: window.location="index.html"; return false; break;
case 63275: case 35: window.location="index.html"; return false; break;
case 13: window.location="slides/01 AEC Regal 1927
interior.html?show_param=3"; break;
}
return true;
}
function keypresslistener() {
if(document.all) document.onkeydown = keypress;
else if(document.layers || document.getElementById) document.onkeypress =
keypress;
}
up0 = new Image(31,31); up0.src = "res/up.gif";
up1 = new Image(31,31); up1.src = "res/up1.gif";
next0 = new Image(31,31);next0.src = "res/next.gif";
next1 = new Image(31,31);next1.src = "res/next1.gif";
prev0 = new Image(31,31);prev0.src = "res/prev.gif";
prev1 = new Image(31,31);prev1.src = "res/prev1.gif";
/* ]]> */
</script>
<link rel="stylesheet" type="text/css" href="res/styles.css" />
<style type="text/css">
body { background-image: url(res/bg.gif); background-repeat: repeat-x; }
</style>
</head>

<body id="body" onload="keypresslistener();">
<div style="width:99%; margin-left:auto; margin-right:auto;
text-align:center;">
<table style="height:54px;" align="center" cellspacing="0" cellpadding="0"
border="0">
<tr><td>
<!-- Header of index pages -->
<table style="width:722px;" cellspacing="0" cellpadding="0" border="0">
<tr>
<td style="width:31px;">
<a href="../" target="_parent">
<img style="border: none;" src="res/up.gif"
onmouseover="this.src=up1.src" onmouseout="this.src=up0.src" width="31"
height="31" title="Up one level" id="up" alt="" /></a></td>

END OF CODE EXTRACT
--
Trevor Lawrence
Canberra
Microsoft MVP - FrontPage
MVP Web Site http://trevorl.mvps.org
 
T

Trevor Lawrence

Thomas A. Rowe said:
No it is not the same locally, unless you are running IIS.

Then what is needed locally?

If you go to the site, you can check that it works there, but absolutely
nothing happens on local disk.

I am trying to copy this site to work on a non-internet connected PC, so if
I could get an answer, it would be great.
 
I

Ian Haynes

Then what is needed locally?

If you go to the site, you can check that it works there, but absolutely
nothing happens on local disk.

I am trying to copy this site to work on a non-internet connected PC, so
if I could get an answer, it would be great.
--

You'd need the full local address of the page. C:\xxxx\whatever.htm.

Or you could use JavaScript, which should work locally,
onclick="history.back();" although this is often not recommended for a
number of reasons I can't recall(!).
 
T

Thomas A. Rowe

You need to run it locally as a server-based site, not as a disk-based site.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
T

Trevor Lawrence

Ian,
Thanks for responding. It would be great to figure this out as it is a
niggling problem.

Ian Haynes said:
You'd need the full local address of the page. C:\xxxx\whatever.htm.

I have tried that.I changed the code to:
<!--a href="../" target="_parent"-->
<a href= "C:\Documents and Settings\Administrator\My Documents\My
Webs\mvpweb\ratec\AEC Buses\index.html" target="_parent">
When hovered over, the status bar reads:
file:///C:/Documents%20and
Settings/Administrator/My%20Documents/My%20Webs/mvpweb/ratec/AEC%20Buses/index.html

This code (the original)
<a href="../" target="_parent">
<!-- a href= "C:\Documents and Settings\Administrator\My Documents\My
Webs\mvpweb\ratec\AEC Buses\index.html" target="_parent"-->
causes this to be displayed in the status bar:
file:///C:/Documents%20and
Settings/Administrator/My%20Documents/My%20Webs/mvpweb/ratec/AEC%20Buses/

In neither case does clicking the button do anything. If the full name had
have worked I was going to write JS to test the current location and if the
website name wasn't present (or even just the characters "http://") then I
would use the local name. Else I would use <a href= "../ "
Or you could use JavaScript, which should work locally,
onclick="history.back();" although this is often not recommended for a
number of reasons I can't recall(!).

One reason I can't do that is that the last page may not be the one I want.
JAlbum will open a separate page for each picture so if 10 have been viewed,
one would need to go back 10 times to get to the higher level index.html
page
 
P

Paul S Wolf

Ian,
Thanks for responding. It would be great to figure this out as it is a
niggling problem.



I have tried that.I changed the code to:
<!--a href="../" target="_parent"-->
<a href= "C:\Documents and Settings\Administrator\My Documents\My
Webs\mvpweb\ratec\AEC Buses\index.html" target="_parent">
When hovered over, the status bar reads:
file:///C:/Documents%20and
Settings/Administrator/My%20Documents/My%20Webs/mvpweb/ratec/AEC%20Buses/index.html

This code (the original)
<a href="../" target="_parent">
<!-- a href= "C:\Documents and Settings\Administrator\My Documents\My
Webs\mvpweb\ratec\AEC Buses\index.html" target="_parent"-->
causes this to be displayed in the status bar:
file:///C:/Documents%20and
Settings/Administrator/My%20Documents/My%20Webs/mvpweb/ratec/AEC%20Buses/

In neither case does clicking the button do anything. If the full name had
have worked I was going to write JS to test the current location and if the
website name wasn't present (or even just the characters "http://") then I
would use the local name. Else I would use <a href= "../ "


One reason I can't do that is that the last page may not be the one I want.
JAlbum will open a separate page for each picture so if 10 have been viewed,
one would need to go back 10 times to get to the higher level index.html
page

Make sure you've replaced all spaces with %20, and take out the
commenting marks (<!-- -->. This:

<!-- a href= "C:\Documents and Settings\Administrator\My Documents\My
Webs\mvpweb\ratec\AEC Buses\index.html" target="_parent"-->

should be

<a href=
"C:\Documents%20and%20Settings\Administrator\My%20Documents\My%20Webs\mvpweb\ratec\AEC
Buses\index.html" target="_parent">
 
T

Trevor Lawrence

Make sure you've replaced all spaces with %20, and take out the commenting
marks (<!-- -->. This:

<!-- a href= "C:\Documents and Settings\Administrator\My Documents\My

should be

<a href=
"C:\Documents%20and%20Settings\Administrator\My%20Documents\My%20Webs\mvpweb\ratec\AEC
Buses\index.html" target="_parent">

Strange.
I have this code
<a href=
"C:\Documents%20and%20Settings\Administrator\My%20Documents\My%20Webs\mvpweb\ratec\AEC%20Buses\index.html"
target="_parent">
<img style="border: none;" src="res/up.gif"
onmouseover="this.src=up1.src" onmouseout="this.src=up0.src"
width="31" height="31" title="Up one level" id="up" alt="" /></a>

Hovering over the button (up.gif) gives this in the status bar
file:///C:/Documents%2520andSettings/Administrator/My%2520Documents/My%2520Webs/mvpweb/ratec/AEC%2520Buses/index.html

Clicking it, of course, does nothing
 
I

Ian Haynes

Strange.
I have this code
<a href=
"C:\Documents%20and%20Settings\Administrator\My%20Documents\My%20Webs\mvpweb\ratec\AEC%20Buses\index.html"
target="_parent">
<img style="border: none;" src="res/up.gif"
onmouseover="this.src=up1.src" onmouseout="this.src=up0.src"
width="31" height="31" title="Up one level" id="up" alt="" /></a>

Hovering over the button (up.gif) gives this in the status bar
file:///C:/Documents%2520andSettings/Administrator/My%2520Documents/My%2520Webs/mvpweb/ratec/AEC%2520Buses/index.html

The %2520's are there because the url is not fully url encoded.

For an easy way to do this see: http://www.hypergurl.com/urlencode.html

file:///c%3A%5CDocuments%20and%20Settings%5CAdministrator%5CMy%20Documents%5CMy%20Webs%5Cmvpweb%5Cratec%5CAEC%20Buses%5Cindex.html

Note the non-encoded file:/// as well. This keeps the link absolute.

When trying this out with some local links I found that c:\ worked and C:\
did'nt. Not sure why.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top