Re: Document title does not work on web
- From: "Trevor Lawrence" <Trevor L.@Canberra>
- Date: Sun, 21 Dec 2008 14:23:43 +1100
David,
I will try to answer the questions in-line.
I have marked your response not prefixed by ">" as Q..and my response as A.
Don't ask me why your response was not all prefixed by ">".. That is beyond
my ken.
"David Mark" <dmark.cinsoft@xxxxxxxxx> wrote in message
news:428218e5-6e91-47de-924b-9bbf95b7c37d@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Dec 19, 9:40 pm, "Trevor Lawrence" <Trevor L.@Canberra> wrote:
I have some JS code to alter the document title to something meaningful
when
a picture is displayed. It works locally but not when the site is uploaded
to the web
For example in http://tandcl.homemail.com.au/index.html
<a href="javascript:newWindow('images/display/trevor.jpg','Trevor');">
Q. Is that meant to be a joke?
A. Why do you ask that ?
I appreciate humour as much as the next person (I hope) but where is the
humour in asking why something doesn't work when I expected it to ? A
serious question, for which I expected a serious answer.
<img src="images/display/trevor.jpg" alt=""
Q. If the image is in a link, it needs alt text to describe the
destination (or action.)
title='Click to see a larger picture'
A. Well, I do have title='Click to see a larger picture' and AFAIK, title=
always works whereas alt= only works when the image is not available
(except of course in IE where alt= works the same way as title= , which is
why I added alt= to meet the requirement that alt= should always be
present.)
Q. Clicking is not the only way to activate the link (which is where this
title should be.)
A. I don't understand. My code is
<a href="javascript:newWindow('images/display/trevor.jpg','Trevor');">
<img src="images/display/trevor.jpg" alt=""
title='Click to see a larger picture'
style="float:left"
height="100" /></a>
1. What other way is there to activate the link ?
2. The title is present in the image tag. Would it make a difference if I
were to code:
<a href="javascript:newWindow('images/display/trevor.jpg','Trevor');"
title='Click to see a larger picture' >
<img src="images/display/trevor.jpg" alt=""
style="float:left"
height="100" /></a>
?
style="float:left"
height="100" /></a>
Q. XHTML?
A. Well, yes. I had originally coded and tested all my pages in
http://validator.w3.org/ as valid XHTML. But since then I may have made
changes that no longer validate. Perhaps I should either revalidate or move
back to HMTL4.01. But like many things, I haven't got around to it. (Some
people have a square tuit, but I haven't got a round tuit <g>)
newWindow uses window.open() to
openhttp://tandcl.homemail.com.au/picture.htmlin a new window
The call is
window.open('picture.html?picture=images/display/trevor.jpg&caption=Trevor&height=500&width=500','',',width=500,height=575,left=390,top=0')
Q. Why the & entities?
A. It seemed like a good idea at the time. IIRC, & always works whereas
& sometimes doesn't. Perhaps you can enlighten me as to where one works and
the other doesn't.
Q. Presumably this code is not in an attribute.
A.I tried to extract the guts of the code rather than sending the whole lot
.. What more do I need to supply to answer the (implied) question: "[Is] this
code .. an attribute?" ?
picture.html calls a JS function getPic() using the parameters picture,
caption, height and width to write the image into an element, change the
document.title and alter the size of the element where the image is
written.
Everything appears to work fine, except that the title is not displayed in
the blue bar. Instead it
sayshttp://tandcl.homemail.com.au/?picture=images.display/trevor.jpg&capt...........
etc
Q. This reflects the fact that on the Web it is not your blue bar
(locally it is.)
A. You seem to be repeating the problem which is that "the title is not
displayed in the blue bar."
I was trying to say that I get different behaviours locally and on the web
for exactly the same code
What extra information are you trying to give me by writing "on the Web it
is not your blue bar" ?
I added alert('document.title= ' + document.title) to the JS and for the
Q. Use window.alert (best to get in the habit.)
A. OK. It may be true that window.alert is correct, but if alert always
works (and it has never failed for me yet) what is the point?
Perhaps you could elucidate why window.alert is better.
Is there an alert which is not a window.alert ?
Are there cases where window.alert is necessary ?
Are there cases where window.alert and alert would do different things ?
picture mentioned, it alerts
document.title = Trevor
Q. You did indeed set that property.
A. Well, that is what thought also.
So why is Trevor being passed to document.title but not displayed in the
header?
Q. You passed it, but the browser dropped it.
A. Perhaps this is where an answer is needed.
Why did the browser drop it?
How can I prevent that from occurring?
Why does this occur on the web, but not locally ? (The answer is not
important, but it would add to my knowledge.)
[snip]
Q. And why would you ask this here?
A. The group scripting.jscript is relevant to JScript and since I use IE, I
guess that is the flavour of JavaScript that I am using
Q. Are you hiding?
A. From whom
--
Trevor Lawrence
Canberra
Web Site http://trevorl.mvps.org
.
- Follow-Ups:
- Re: Document title does not work on web
- From: David Mark
- Re: Document title does not work on web
- References:
- Document title does not work on web
- From: Trevor Lawrence
- Re: Document title does not work on web
- From: David Mark
- Document title does not work on web
- Prev by Date: Re: Document title does not work on web
- Next by Date: Bottom DIV handles events from top DIV layers only in IE6,7
- Previous by thread: Re: Document title does not work on web
- Next by thread: Re: Document title does not work on web
- Index(es):
Relevant Pages
|