need a clue

  • Thread starter Charles Harrison Caudill
  • Start date
C

Charles Harrison Caudill

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...
 
R

Richard Cornford

Charles said:
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.
 
C

Charles Harrison Caudill

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

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/xhtml/index.php?page=xhtml+frame+basics&parent=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!
 
G

Grant Wagner

Charles said:
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. :)

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.
 
C

Charles Harrison Caudill

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.
 
T

Thomas 'PointedEars' Lahn

Richard said:
^
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
 

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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top