Dr J R Stockton
2014-12-25 12:03:53 UTC
I am using Firefox with Tools, Web Developer, Web Console (Ctrl-Shift-K)
and this code :-
function RequestData() {
addCallback(Ifr1, "load", SelectReadings)
Ifr1.src = E7form.Fname.value.trim() }
function SelectReadings() { var Lines
removeCallback(Ifr1, "load", SelectReadings)
Lines = Ifr1.contentDocument.body.innerHTML.split(/\n/)
...
The page executing the code, and the file named in FName, are both on my
Windows C: drive, and the file, which is plain seven-bit text and
numbers in a *.TXT file, shows in the iframe pointed to by Ifr1, and
Lines receives the correct contents.
BUT - Web Console gives the Warning "! The character encoding of a
framed document was not declared. The document may appear different if
viewed without the document framing it." which is annoying.
Can, and if so how can, this particular warning be eliminated, by
altering the beginning of the TXT file or by altering the displaying
page/script or both?
BTW, the code works for me in some other browsers, but not in Chrome.
Observation :-
It is very easy to present the results of a set of calculations in a
TextArea, but AFAICS there is no direct provision for printing the
content of a TextArea. It is sufficiently easy to transfer the content
of the TextArea, adding PRE and changing \n to <br>, to an Iframe (and
to get the same result without using the TextArea). In Firefox at
least, a right click in the Iframe enters a direct route to printing out
_only_ the content of the frame. The following code fragment could
provide sufficient clues :-
Ifr2.src = "javascript:'<pre>" + Arr2.join("<br>") + "<\/pre>'"
Ifr2.style.height = Arr2.length*2.7 + "ex"
One can also add HTML formatting into the contents of Arr2.
and this code :-
function RequestData() {
addCallback(Ifr1, "load", SelectReadings)
Ifr1.src = E7form.Fname.value.trim() }
function SelectReadings() { var Lines
removeCallback(Ifr1, "load", SelectReadings)
Lines = Ifr1.contentDocument.body.innerHTML.split(/\n/)
...
The page executing the code, and the file named in FName, are both on my
Windows C: drive, and the file, which is plain seven-bit text and
numbers in a *.TXT file, shows in the iframe pointed to by Ifr1, and
Lines receives the correct contents.
BUT - Web Console gives the Warning "! The character encoding of a
framed document was not declared. The document may appear different if
viewed without the document framing it." which is annoying.
Can, and if so how can, this particular warning be eliminated, by
altering the beginning of the TXT file or by altering the displaying
page/script or both?
BTW, the code works for me in some other browsers, but not in Chrome.
Observation :-
It is very easy to present the results of a set of calculations in a
TextArea, but AFAICS there is no direct provision for printing the
content of a TextArea. It is sufficiently easy to transfer the content
of the TextArea, adding PRE and changing \n to <br>, to an Iframe (and
to get the same result without using the TextArea). In Firefox at
least, a right click in the Iframe enters a direct route to printing out
_only_ the content of the frame. The following code fragment could
provide sufficient clues :-
Ifr2.src = "javascript:'<pre>" + Arr2.join("<br>") + "<\/pre>'"
Ifr2.style.height = Arr2.length*2.7 + "ex"
One can also add HTML formatting into the contents of Arr2.
--
(c) John Stockton, nr London, UK. For Mail, see Home Page. Turnpike, WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links.
Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
DOS/Win/UNIX now 2.0.6; see my <http://www.merlyn.demon.co.uk/pc-links.htm>.
(c) John Stockton, nr London, UK. For Mail, see Home Page. Turnpike, WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links.
Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
DOS/Win/UNIX now 2.0.6; see my <http://www.merlyn.demon.co.uk/pc-links.htm>.