need a clue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles Harrison Caudill

    #1

    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.hyperspher e.org/photo_header.ht ml"
    scrolling="no"
    name="header"
    id="header"
    />
    <frame src="http://gtda.hyperspher e.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.javas cript, 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
  • Richard Cornford

    #2
    Re: need a clue

    Charles Harrison Caudill wrote:[color=blue]
    > 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.[/color]

    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.
    [color=blue]
    > 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.[/color]

    That impression will prove to be the result of human error.
    [color=blue]
    > 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.hyperspher e.org/photo_header.ht ml"
    > scrolling="no"
    > name="header"
    > id="header"
    > />[/color]
    ^
    Does XHTML recognise frame and frameset elements?
    [color=blue]
    > <frame src="http://gtda.hyperspher e.org/photo" />
    > </frameset>
    >
    > for now, I'd be happy if I could get resize() to simply alert
    > me of the height of that document,[/color]

    And the definition of this "resize" function is? And its location
    relative to the frameset?
    [color=blue]
    > 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),[/color]

    You should be able to access the HTML FRAME and FRAMESET elements in the
    frameset document with document.getEle mentById, but the elements within
    a document DOM do not necessarily correspond with the frame (or global)
    objects that belong to each contained frame.
    [color=blue]
    > but never by document or
    > parent.document .frames[0] or .frames.item("h eader") or anything else
    > like that.[/color]

    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.
    [color=blue]
    > I haven't seen something this nonsensical since Thermodynamics
    > or maybe trying to decipher the Linux VFS layer.
    >
    > help me comp.lang.javas cript, you're my only hope...[/color]

    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.


    Comment

    • Charles Harrison Caudill

      #3
      Re: need a clue

      Richard Cornford <Richard@litote s.demon.co.uk> wrote:[color=blue]
      > Charles Harrison Caudill wrote:[color=green]
      >> I've been going through tutorials, APIs, posts on this[/color][/color]
      <snip rant>
      [color=blue]
      > 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.[/color]

      I think I'm misinterpreting this, how does a javascripter predict the
      behavior of the foundation classes?
      [color=blue]
      > That impression will prove to be the result of human error.[/color]

      I'd actually attribute that one to 4am with too much climbing, not enough
      food, and certainly not enough caffeine :-P
      [color=blue][color=green]
      >> I've been trying to get a frame to shrink to fit the contents because[/color][/color]

      That's my real objective, I've seen examples where this can be done using
      javascript, but none of them seem to work.
      [color=blue]
      > Does XHTML recognise frame and frameset elements?[/color]

      It appears to:


      I've become unfirmiliar with the various web technologies since I was 14.
      [color=blue]
      > 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.[/color]
      [color=blue]
      > frames['header'] // in the correct context.[/color]

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

      alert(frames['header']);

      produces the text: "[object inaccessible]"

      however:

      alert(top.windo w.document.getE lementById("hea der"));

      produces the text: "[object HTMLFrameElemen t]"
      [color=blue]
      > parent.frames['header'] // from a child frame.[/color]

      alert(parent.fr ames['header']) when called in the javascript of the child
      frame doesn't even run, it errors out.
      [color=blue]
      > The - frames - collection as a property of the document object is best
      > avoided as it is not as widely supported.[/color]

      ahh...
      [color=blue]
      > 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.[/color]

      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

      Comment

      • Grant Wagner

        #4
        Re: need a clue

        Charles Harrison Caudill wrote:
        [color=blue]
        > Richard Cornford <Richard@litote s.demon.co.uk> wrote:
        >[color=green]
        > > 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.[/color]
        >
        > I think I'm misinterpreting this, how does a javascripter predict the
        > behavior of the foundation classes?[/color]

        "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. :)
        [color=blue][color=green]
        > > Does XHTML recognise frame and frameset elements?[/color]
        >
        > It appears to:
        > http://academ.hvcc.edu/~kantopet/xht...t=xhtml+frames[/color]

        Presumably you are including the !DOCTYPE for the Frameset DTD as indicated on that page.
        [color=blue][color=green]
        > > 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.[/color]
        >[color=green]
        > > frames['header'] // in the correct context.[/color]
        >
        > I've seen numerous accounts where that *should* work, but in this case:
        >
        > alert(frames['header']);
        >
        > produces the text: "[object inaccessible]"[/color]

        Is 'header' from a different domain?
        [color=blue]
        > however:
        >
        > alert(top.windo w.document.getE lementById("hea der"));
        >
        > produces the text: "[object HTMLFrameElemen t]"[/color]

        Which may well be inaccessible if it is from another domain.
        [color=blue][color=green]
        > > parent.frames['header'] // from a child frame.[/color]
        >
        > alert(parent.fr ames['header']) when called in the javascript of the child
        > frame doesn't even run, it errors out.[/color]

        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 <gwagner@agrico reunited.com>
        comp.lang.javas cript FAQ - http://jibbering.com/faq

        Comment

        • Charles Harrison Caudill

          #5
          Re: need a clue

          Grant Wagner <gwagner@agrico reunited.com> wrote:

          <snip>[color=blue]
          > support, or do not support in the same way, that host object.[/color]
          [color=blue]
          > Welcome to client-side browser scripting in the 21st century. :)[/color]

          It's like making estimations less inaccurate in Stastical Mechanics only
          with Javascript instead of math and physics :-P
          [color=blue][color=green]
          >> alert(frames['header']);
          >> produces the text: "[object inaccessible]"[/color][/color]
          [color=blue]
          > Is 'header' from a different domain?[/color]

          nope, same domain
          [color=blue]
          > Which may well be inaccessible if it is from another domain.[/color]
          [color=blue][color=green][color=darkred]
          >> > parent.frames['header'] // from a child frame.[/color]
          >>
          >> alert(parent.fr ames['header']) when called in the javascript of the child
          >> frame doesn't even run, it errors out.[/color][/color]

          I misspoke, that was being run from the header frame (trying to get a
          reference to itself).
          [color=blue]
          > 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.[/color]

          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

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: need a clue

            Richard Cornford wrote:
            [color=blue]
            > Charles Harrison Caudill wrote:[color=green]
            >> <frameset rows="90,*" border="0" onload="resize( )">
            >> <frame
            >> src="http://gtda.hyperspher e.org/photo_header.ht ml"
            >> scrolling="no"
            >> name="header"
            >> id="header"
            >> />[/color]
            > ^
            > Does XHTML recognise frame and frameset elements?[/color]

            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.

            Comment

            Working...