stopping the focus on a page from moving

N

Nick Wedd

I have a test page http://www.files.maproom.org/00/12/q/w.html which
almost does what I want.

The idea is that, when you hover the mouse over one of the dates near
the top of the page, it updates _both_ the appearance of the map, _and_
the text appearing in the iframes further down the page. I would like
it to do this smoothly; but each time you select a new page, the
browser window jerks down to the iframes (where the text was refreshed)
and back to the top of the page (where I have arranged for another
invisible iframe to be refreshed, to bring the focus back to the top).

Both Mozilla and IE show this behaviour (IE doesn't display the map
properly, but that's another problem which I can do nothing about).
Opera6 actually shows the behaviour I am looking for.

Can anyone suggest a way to refresh the contents of my iframes without
the focus going down there to look at them, however briefly? I have
tried putting a div round the iframes and temporarily making it hidden
while I do the refresh, but this doesn't help, the focus still goes to
look at the invisible iframes.

Nick
 
W

web.dev

Nick said:
I have a test page http://www.files.maproom.org/00/12/q/w.html which
almost does what I want.

The idea is that, when you hover the mouse over one of the dates near
the top of the page, it updates _both_ the appearance of the map, _and_
the text appearing in the iframes further down the page. I would like
it to do this smoothly; but each time you select a new page, the
browser window jerks down to the iframes (where the text was refreshed)
and back to the top of the page (where I have arranged for another
invisible iframe to be refreshed, to bring the focus back to the top).

Both Mozilla and IE show this behaviour (IE doesn't display the map
properly, but that's another problem which I can do nothing about).
Opera6 actually shows the behaviour I am looking for.

Can anyone suggest a way to refresh the contents of my iframes without
the focus going down there to look at them, however briefly? I have
tried putting a div round the iframes and temporarily making it hidden
while I do the refresh, but this doesn't help, the focus still goes to
look at the invisible iframes.

Nick

Looking at your changedate function, you are changing the "source"
through the use of the hash in the uri. This normally causes the page
to jump to where the named anchor is located. I would try placing the
individual dates in separate html pages instead so the jump does not
occur.
 
R

RobG

Nick said:
I have a test page http://www.files.maproom.org/00/12/q/w.html which
almost does what I want.

The idea is that, when you hover the mouse over one of the dates near
the top of the page, it updates _both_ the appearance of the map, _and_
the text appearing in the iframes further down the page. I would like
it to do this smoothly; but each time you select a new page, the
browser window jerks down to the iframes (where the text was refreshed)
and back to the top of the page (where I have arranged for another
invisible iframe to be refreshed, to bring the focus back to the top).

Both Mozilla and IE show this behaviour (IE doesn't display the map
properly, but that's another problem which I can do nothing about).
Opera6 actually shows the behaviour I am looking for.

Can anyone suggest a way to refresh the contents of my iframes without
the focus going down there to look at them, however briefly? I have
tried putting a div round the iframes and temporarily making it hidden
while I do the refresh, but this doesn't help, the focus still goes to
look at the invisible iframes.

Start by validating your page, you have 34 errors, many serious (a DIV
element inside a HEAD and others inside A elements).

<URL:
http://validator.w3.org/check?uri=http://www.files.maproom.org/00/12/q/w.html

You also have:
<script language="JavaScript">

The language attribute is deprecated, type is required:


Do not use HTML comment delimiters inside script tags, they peform no
useful function and are potentially harmful.

window.onresize = new Function("sifw()");

There is no need to create a new function object every time the page is
resized, you just want to run the existing function:

window.onresize = sifw;
 
N

Nick Wedd

RobG said:
Start by validating your page, you have 34 errors, many serious (a DIV
element inside a HEAD and others inside A elements).

The DIV inside the HEAD has gone, that was a bodge made unnecessary by
web.dev's advice, which I have taken. Thank you, web.dev.

I have also rearranged things so that there is no longer a DIV element
inside an A element. Thank you for this advice.

Thank you for recommending this. I shall run this page, and others,
through the validator.
You also have:


The language attribute is deprecated, type is required:

<script type="text/javascript">

Ok, thank you, I have made that change.
Do not use HTML comment delimiters inside script tags, they peform no
useful function and are potentially harmful.

They _do_ perform a useful function (I am sure you know what it is), and
they seem to do no harm. But I accept that if someone looks at this
page with a browser that knows nothing about javascript, they aren't
going to have any joy anyway.
There is no need to create a new function object every time the page is
resized, you just want to run the existing function:

window.onresize = sifw;

This sounds like good advice. However,
window.onresize = new Function("sifw()");
works with Mozilla 1.6, Opera 6, IE6, and Firefox 1.0.7, while
window.onresize = sifw;
fails to work with any of these browsers, and moreover generates an
error message with IE6.

I have uploaded a new version of
http://www.files.maproom.org/00/12/q/w.html
incorporating various improvements, thanks to you and to web.dev;
also a version
http://www.files.maproom.org/00/12/q/ww.html
which incorporates your suggestion of using
window.onresize = sifw;
The sifw function is meant to cause the iframe panels, with German and
English text, to resize when the browser window is resized.

Nick
 
T

Thomas 'PointedEars' Lahn

Nick said:
[...] RobG [...] writes
Do not use HTML comment delimiters inside script tags, they peform no
useful function and are potentially harmful.

They _do_ perform a useful function (I am sure you know what it is),

They do not. There is no compliant HTML UA out there that is allowed to
interpret the content of the `script' element as text (introduced in HTML
3.2, previous HTML versions being obsoleted and control about HTML passed
on to W3C by RFC2854 [June 2000]) , especially not within the `head'
element where _no_ text node is allowed to result in visible display.
and they seem to do no harm.

There is no standard or reference on how to parse such code in HTML.
Examples in the Specification are informative, not normative.

There is no standard or reference on how to parse such code in any
ECMAScript conforming implementation as `<', `!' and `--' are operators.
Strictly, it leads to a script SyntaxError if the parser correctly
considers the `script' element's content as CDATA that is _not_ to be
parsed (except of looking for the CDATA-closing ETAGO delimiter `</'.)

In XHTML, it is potentially harmful as that is an XML application. An XML
parser is allowed to remove all comments before building the parse tree.
<script ...><!-- ... --></script> results in <script .../>, an empty
`script' element. Calls to functions supposed-to-be declared in that
`script' element would result in a ReferenceError as they would not be
declared at all.

See also
But I accept that if someone looks at this page with a browser that
knows nothing about javascript, they aren't going to have any joy
anyway.

That is not the issue. The support, i.e. the ability of parsers to
recognize the `script' element and to ignore it altogether with its
content if the required script support is not present, especially
not to display it within the `head' element, is the issue. That
support can be considered present nowadays while the opposite (that
those delimiters are either overlooked by the markup parser or the
script engine) cannot be considered present.
This sounds like good advice. However,
window.onresize = new Function("sifw()");
works with Mozilla 1.6, Opera 6, IE6, and Firefox 1.0.7, while
window.onresize = sifw;
fails to work with any of these browsers, and moreover generates an
error message with IE6.

Syntactically, it does not. If it does, there is something wrong the
Function object referred to. What is wrong, probably tells the error
message you do not really tell about.

<URL:http://jibbering.com/faq/#FAQ4_43>


PointedEars
 

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

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,616
Members
45,306
Latest member
TeddyWeath

Latest Threads

Top