471,350 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

need a clue

I've been going through tutorials, APIs, posts on this newsgroup, this
newsgroup's faq, etc...

I have a function that describes the fields that an object claims to have and
I have found what that function reports to often be contradictory to what it
will actually respond to. I have seen objects whose toString method returns
"[object inaccessible]" (which Google is unaware of practically btw) return a
correct value when I request the "name" field, but even though they are
supposed to be of a certain type, "name" is the only field it acknowledges
having. I've watched practically all example code fail utterly. I have
combed the APIs for Opera, Mozilla, IE and found many useful methods I'd like
to use that don't run. I've watched code work, then quit working because I
changed a name then changed it back. My opinion of javascript thus far can be
summarized in the following posit:

Javascript is non turing-compliant,
in a given state, with a given set of inputs it may or may not do the same
thing as the last time it was in that state with those inputs.

I've been trying to get a frame to shrink to fit the contents because some
browsers will render a table in such a manner that even though the sum of
heights of the cells at the side of a picture is smaller than the height of
the picture, and the cell spacing is set to 0, the browser still adds a
spacing causing the cells at the side to be taller than the picture.

I have two frames declared as follows:

<frameset rows="90,*" border="0" onload="resize()">
<frame
src="http://gtda.hypersphere.org/photo_header.html"
scrolling="no"
name="header"
id="header"
/>
<frame src="http://gtda.hypersphere.org/photo" />
</frameset>

for now, I'd be happy if I could get resize() to simply alert me of the height
of that document, or maybe if I could just get it to follow the api's, or
possibly if I could figure out why I can access the frame by getElementById
(sometimes), but never by document or parent.document .frames[0] or
..frames.item("header") or anything else like that.

I haven't seen something this nonsensical since Thermodynamics or maybe trying
to decipher the Linux VFS layer.

help me comp.lang.javascript, you're my only hope...

--
Harrison Caudill | .^ www.hypersphere.org
Computer Science & Physics Double Major | | Me*Me=1
Georgia Institute of Technology | v' I'm just a normal guy
Jul 23 '05 #1
5 1252
Charles Harrison Caudill wrote:
I've been going through tutorials, APIs, posts on this
newsgroup, this newsgroup's faq, etc...

I have a function that describes the fields that an object claims
to have and I have found what that function reports to often be
contradictory to what it will actually respond to. I have seen
objects whose toString method returns "[object inaccessible]" (which
Google is unaware of practically btw) return a correct value when I
request the "name" field, but even though they are supposed to be of
a certain type, "name" is the only field it acknowledges having.
Javascript (more explicitly ECMAScript) is designed to be used to script
an object model provided by a host. It defines objects in the host's
object model as "host objects" and makes virtually no requirements of
their behaviour.
I've watched practically all example code fail utterly. I have
combed the APIs for Opera, Mozilla, IE and found many useful methods
I'd like to use that don't run. I've watched code work, then quit
working because I changed a name then changed it back. My opinion
of javascript thus far can be summarized in the following posit:

Javascript is non turing-compliant,
in a given state, with a given set of inputs it may or may not do the
same thing as the last time it was in that state with those inputs.
That impression will prove to be the result of human error.
I've been trying to get a frame to shrink to fit the contents because
some browsers will render a table in such a manner that even though
the sum of heights of the cells at the side of a picture is smaller
than the height of the picture, and the cell spacing is set to 0, the
browser still adds a spacing causing the cells at the side to be
taller than the picture.

I have two frames declared as follows:

<frameset rows="90,*" border="0" onload="resize()">
<frame
src="http://gtda.hypersphere.org/photo_header.html"
scrolling="no"
name="header"
id="header"
/> ^
Does XHTML recognise frame and frameset elements?
<frame src="http://gtda.hypersphere.org/photo" />
</frameset>

for now, I'd be happy if I could get resize() to simply alert
me of the height of that document,
And the definition of this "resize" function is? And its location
relative to the frameset?
or maybe if I could just get it to
follow the api's, or possibly if I could figure out why I can access
the frame by getElementById (sometimes),
You should be able to access the HTML FRAME and FRAMESET elements in the
frameset document with document.getElementById, but the elements within
a document DOM do not necessarily correspond with the frame (or global)
objects that belong to each contained frame.
but never by document or
parent.document .frames[0] or .frames.item("header") or anything else
like that.
Frame elements that have both IDs and name attributes should be
available as named members of the - frames - collection in the global
object at the frameset level in the tree of frame/window/global objects.

frames['header'] // in the correct context.

parent.frames['header'] // from a child frame.

The - frames - collection as a property of the document object is best
avoided as it is not as widely supported.
I haven't seen something this nonsensical since Thermodynamics
or maybe trying to decipher the Linux VFS layer.

help me comp.lang.javascript, you're my only hope...


If you don't make your code available for examination it is only
possible to guess what it is you are doing wrong, and with almost
infinite possibilities it isn't worth anyone's while guessing.

Richard.
Jul 23 '05 #2
Richard Cornford <Ri*****@litotes.demon.co.uk> wrote:
Charles Harrison Caudill wrote:
I've been going through tutorials, APIs, posts on this <snip rant>
Javascript (more explicitly ECMAScript) is designed to be used to script
an object model provided by a host. It defines objects in the host's
object model as "host objects" and makes virtually no requirements of
their behaviour.
I think I'm misinterpreting this, how does a javascripter predict the
behavior of the foundation classes?
That impression will prove to be the result of human error.
I'd actually attribute that one to 4am with too much climbing, not enough
food, and certainly not enough caffeine :-P
I've been trying to get a frame to shrink to fit the contents because


That's my real objective, I've seen examples where this can be done using
javascript, but none of them seem to work.
Does XHTML recognise frame and frameset elements?
It appears to:
http://academ.hvcc.edu/~kantopet/xht...t=xhtml+frames

I've become unfirmiliar with the various web technologies since I was 14.
Frame elements that have both IDs and name attributes should be
available as named members of the - frames - collection in the global
object at the frameset level in the tree of frame/window/global objects. frames['header'] // in the correct context.
I've seen numerous accounts where that *should* work, but in this case:

alert(frames['header']);

produces the text: "[object inaccessible]"

however:

alert(top.window.document.getElementById("header") );

produces the text: "[object HTMLFrameElement]"
parent.frames['header'] // from a child frame.
alert(parent.frames['header']) when called in the javascript of the child
frame doesn't even run, it errors out.
The - frames - collection as a property of the document object is best
avoided as it is not as widely supported.
ahh...
If you don't make your code available for examination it is only
possible to guess what it is you are doing wrong, and with almost
infinite possibilities it isn't worth anyone's while guessing.


Granted, in my 4am stupor I neglected to mention that I had done 6 hrs
of work on it and it would have been impractical to include the entire
history.

Thanks for such a speedy response!

--
Harrison Caudill | .^ www.hypersphere.org
Computer Science & Physics Double Major | | Me*Me=1
Georgia Institute of Technology | v' I'm just a normal guy
Jul 23 '05 #3
Charles Harrison Caudill wrote:
Richard Cornford <Ri*****@litotes.demon.co.uk> wrote:
Javascript (more explicitly ECMAScript) is designed to be used to script
an object model provided by a host. It defines objects in the host's
object model as "host objects" and makes virtually no requirements of
their behaviour.
I think I'm misinterpreting this, how does a javascripter predict the
behavior of the foundation classes?


"host objects" are not foundation classes. They are host objects. And you predict their
behaviour by reading the documentation on each user agent you want to support, then testing the
behaviour on each user agent you want to support to ensure it conforms to the documented
behaviour. Then you make sure that the behaviour fails gracefully in user agents which do not
support, or do not support in the same way, that host object.

Welcome to client-side browser scripting in the 21st century. :)
Does XHTML recognise frame and frameset elements?


It appears to:
http://academ.hvcc.edu/~kantopet/xht...t=xhtml+frames


Presumably you are including the !DOCTYPE for the Frameset DTD as indicated on that page.
Frame elements that have both IDs and name attributes should be
available as named members of the - frames - collection in the global
object at the frameset level in the tree of frame/window/global objects.

frames['header'] // in the correct context.


I've seen numerous accounts where that *should* work, but in this case:

alert(frames['header']);

produces the text: "[object inaccessible]"


Is 'header' from a different domain?
however:

alert(top.window.document.getElementById("header") );

produces the text: "[object HTMLFrameElement]"


Which may well be inaccessible if it is from another domain.
parent.frames['header'] // from a child frame.


alert(parent.frames['header']) when called in the javascript of the child
frame doesn't even run, it errors out.


You would use parent.frames['header'] from a sibling of 'header', not a child.

As Richard has already mentioned, a simple example of what you are trying to achieve would make
it possible for us to more closely examine the problems with your code. Also, simplifying what
you are trying to achieve very often reveals the solution to the problem you are attempting to
solve.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #4
Grant Wagner <gw*****@agricoreunited.com> wrote:

<snip>
support, or do not support in the same way, that host object. Welcome to client-side browser scripting in the 21st century. :)
It's like making estimations less inaccurate in Stastical Mechanics only
with Javascript instead of math and physics :-P
alert(frames['header']);
produces the text: "[object inaccessible]" Is 'header' from a different domain?
nope, same domain
Which may well be inaccessible if it is from another domain.
> parent.frames['header'] // from a child frame.


alert(parent.frames['header']) when called in the javascript of the child
frame doesn't even run, it errors out.


I misspoke, that was being run from the header frame (trying to get a
reference to itself).
As Richard has already mentioned, a simple example of what you are trying to achieve would make
it possible for us to more closely examine the problems with your code.


As I said before, I've tried so many permutations of so many different ways
to figure out the height of the body of the child frame after rendering that
I can't really give an example, because I don't really have a codebase, I have
a long and convoluted history of many many things I've tried.

I just wanted to shrink a frame to fit the contents.

I appreciate the response, but, honestly, my will has been broken for now;
I'll probably come back to this in a month or so, but it was never important
enough for the time I've already spent on it. I just got mad and wanted to
get it done.

After my little escapade in Javascript, I have much respect for anyone who
is capable of getting things done with this language.

--
Harrison Caudill | .^ www.hypersphere.org
Computer Science & Physics Double Major | | Me*Me=1
Georgia Institute of Technology | v' I'm just a normal guy
Jul 23 '05 #5
Richard Cornford wrote:
Charles Harrison Caudill wrote:
<frameset rows="90,*" border="0" onload="resize()">
<frame
src="http://gtda.hypersphere.org/photo_header.html"
scrolling="no"
name="header"
id="header"
/>

^
Does XHTML recognise frame and frameset elements?


You mean if an *XML parser* recogizes them? Yes, if you declare the
XHTML 1.0 Frameset DTD. However, using XHTML instead of HTML on the
Web is another issue, especially when nonsensically served as text/html.
PointedEars
--
If the wind changes it will freeze like that.
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Robert Maas, see http://tinyurl.com/uh3t | last post: by
4 posts views Thread by kazack | last post: by
reply views Thread by Dan McCoy | last post: by
35 posts views Thread by Boobie | last post: by
7 posts views Thread by Timothy Shih | last post: by
2 posts views Thread by wazoo | last post: by
17 posts views Thread by Chad A. Beckner | last post: by
21 posts views Thread by asif929 | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.