Frames and Javascript (Oh, the pain!)

Discussion in 'HTML' started by Owen Jacobson, Apr 1, 2004.

  1. Salve.

    I'm working on a prototype web-based frontend for an application[0] as
    part of a proposal at work. Development is on a Windows server[1] using
    IIS[1]; installing extra modules like PHP or ActiveState Perl, while
    possible, will seriously impact the prototype evaluation later.

    This is a strictly internal web tool, and not meant for the internet at
    large; nonetheless, I'd like to keep it as standards-compliant as
    possible. The target browser right now is Internet Explorer[1], but I'd
    like it to work properly under as many Javascript-enabled user agents as
    possible and be at least usable under any HTTP agent. That latter
    requirement works, right now.

    Right now, the frontend is two frames[1]; the top one ("display") contains
    a simple HTML page that contains an image pulled from the application
    itself, while the bottom frame ("control") has a pair of forms for
    manually entering queries for the application.

    One of the two queries involves querying a pixel on the image for feature
    information. Right now, the form requires you to type in the X and Y
    coordinate of the pixel you'd like to query. I'd like to be able to query
    by clicking directly on the image in "display". For a variety of reasons,
    I'd rather implement this on the client side than write more server-side
    code; Javascript is the obvious choice for that.

    Is there any way I can, when the image in "display" is clicked, transmit
    the relative x,y coordinate of the click to the relevant fields in the
    form on frame "control" and then submit the form?

    [0] An implementation of the OpenGIS Web Map Service specification
    [1] Chorus: "Doctor, it hurts when I do this!"
    --
    Some say the Wired doesn't have political borders like the real world,
    but there are far too many nonsense-spouting anarchists or idiots who
    think that pranks are a revolution.
     
    Owen Jacobson, Apr 1, 2004
    #1
    1. Advertising

  2. Owen Jacobson

    brucie Guest

    in post: <news:p>
    Owen Jacobson <> said:

    > I'm working on a prototype web-based frontend for an application[0] as
    > part of a proposal at work. Development is on a Windows server[1] using
    > IIS[1]; installing extra modules like PHP or ActiveState Perl, while
    > possible, will seriously impact the prototype evaluation later.


    shoot yourself in the head. it wont hurt as much, be much easier and the
    end result will pretty much be the same.

    > This is a strictly internal web tool, and not meant for the internet at
    > large; nonetheless, I'd like to keep it as standards-compliant as
    > possible. The target browser right now is Internet Explorer[1],


    standard compliant in the most non standards compliant browser?

    > Right now, the frontend is two frames[1];


    aahhhaaaaaaa

    > One of the two queries involves querying a pixel on the image for feature
    > information. Right now, the form requires you to type in the X and Y
    > coordinate of the pixel you'd like to query. I'd like to be able to query
    > by clicking directly on the image in "display". For a variety of reasons,
    > I'd rather implement this on the client side than write more server-side
    > code; Javascript is the obvious choice for that.


    server side would make very much more sense and be infinitely simpler.

    1. ismap the image
    2. click on image
    3. coords of pixel sent to server side script
    4. server side script does whatever you want it to.
    5. leave an hour earlier and go to the pub
    6. easy


    --
    b r u c i e
     
    brucie, Apr 1, 2004
    #2
    1. Advertising

  3. On Thu, 01 Apr 2004 10:47:16 +1000, brucie wrote:

    Sup, brucie. :) Warms my heart to see you back.

    > in post: <news:p>
    > Owen Jacobson <> said:
    >
    >> I'm working on a prototype web-based frontend for an application[0] as
    >> part of a proposal at work. Development is on a Windows server[1] using
    >> IIS[1]; installing extra modules like PHP or ActiveState Perl, while
    >> possible, will seriously impact the prototype evaluation later.

    >
    > shoot yourself in the head. it wont hurt as much, be much easier and the
    > end result will pretty much be the same.


    It gets better. Consider, if you will, the logic of dictating the above
    in the same breath as "Oh, and we'll be porting it to Solaris later, too."

    >> This is a strictly internal web tool, and not meant for the internet at
    >> large; nonetheless, I'd like to keep it as standards-compliant as
    >> possible. The target browser right now is Internet Explorer[1],

    >
    > standard compliant in the most non standards compliant browser?


    In the hopes of convincing manglement that supporting things besides IE is
    not only a good idea, but fairly easy (actually, in my experience easier,
    but try convincing a Microsoft shop of that) too.

    >> One of the two queries involves querying a pixel on the image for feature
    >> information. Right now, the form requires you to type in the X and Y
    >> coordinate of the pixel you'd like to query. I'd like to be able to query
    >> by clicking directly on the image in "display". For a variety of reasons,
    >> I'd rather implement this on the client side than write more server-side
    >> code; Javascript is the obvious choice for that.

    >
    > server side would make very much more sense and be infinitely simpler.
    >
    > 1. ismap the image
    > 2. click on image
    > 3. coords of pixel sent to server side script
    > 4. server side script does whatever you want it to.
    > 5. leave an hour earlier and go to the pub
    > 6. easy


    Got any scripting proposals that aren't ASP (because I'll have to port it
    to Solaris later; see above) or C++ (which is, admittedly, what the rest
    of the app is in)? I'm all ears, because I know the way I'm doing it is
    dumb; it just seems the least dumb of a plethora of irritating options.

    --
    Some say the Wired doesn't have political borders like the real world,
    but there are far too many nonsense-spouting anarchists or idiots who
    think that pranks are a revolution.
     
    Owen Jacobson, Apr 1, 2004
    #3
  4. Owen Jacobson

    Jeff Thies Guest

    > Right now, the frontend is two frames[1]; the top one ("display") contains
    > a simple HTML page that contains an image pulled from the application
    > itself, while the bottom frame ("control") has a pair of forms for
    > manually entering queries for the application.
    >
    > One of the two queries involves querying a pixel on the image for feature
    > information. Right now, the form requires you to type in the X and Y
    > coordinate of the pixel you'd like to query. I'd like to be able to query
    > by clicking directly on the image in "display". For a variety of reasons,
    > I'd rather implement this on the client side than write more server-side
    > code; Javascript is the obvious choice for that.


    You need to be over in comp.lang.javascript!

    Something like:

    <script type="text/javascript">
    document.omousedown=getPosition;

    function getPosition(){
    x=event.x; y=event.y // that's an IE only reference

    frame_name.document['form_name']['form_element_name'].value=x;

    ....
    }

    ....

    Season to taste.

    Cheers,
    Jeff

    >
    > Is there any way I can, when the image in "display" is clicked, transmit
    > the relative x,y coordinate of the click to the relevant fields in the
    > form on frame "control" and then submit the form?
    >
    > [0] An implementation of the OpenGIS Web Map Service specification
    > [1] Chorus: "Doctor, it hurts when I do this!"
    > --
    > Some say the Wired doesn't have political borders like the real world,
    > but there are far too many nonsense-spouting anarchists or idiots who
    > think that pranks are a revolution.
    >
     
    Jeff Thies, Apr 1, 2004
    #4
  5. Owen Jacobson wrote:
    <snip>
    > Is there any way I can, when the image in "display" is clicked,
    > transmit the relative x,y coordinate of the click to the relevant
    > fields in the form on frame "control" and then submit the form?

    <snip>

    Yes it is easy, given a sub set of javascript enabled/capable browsers
    (that excludes a number of PDA and embedded browsers that don't make the
    relative position of page element available, but, of those, the ones
    that I could name don't support frames anyway so they are already out of
    the picture).

    Any mouse event will provide an event object that holds numerous mouse
    position values. The simples approach for cross-browser support is to
    normalise those values into offsets into the HTML page (as opposed to
    offsets over the image, screen offsets or client area offsets). Then
    subtracting the offset of the image in the HTML document gives the
    co-ordinates over the image, and then it is just a matter of writing the
    values into the - value - properties of the form elements in the other
    frame.

    For reliability a server-side solution would be better, but optimum
    might be to implement the javascript to short-circuit the request to the
    server whenever it was capable of doing the job locally (though that
    would need to be actively verified because the ability to execute a
    client-side script does not imply that the browser will facilitate the
    task it wants to undertake).

    Richard.
     
    Richard Cornford, Apr 1, 2004
    #5
  6. Owen Jacobson

    brucie Guest

    in post: <news:p>
    Owen Jacobson <> said:

    > Sup, brucie. :) Warms my heart to see you back.


    you're sick

    >> 1. ismap the image
    >> 2. click on image
    >> 3. coords of pixel sent to server side script
    >> 4. server side script does whatever you want it to.
    >> 5. leave an hour earlier and go to the pub
    >> 6. easy


    > Got any scripting proposals


    the above was about it. once you ismap the image the coords of the pixel
    are passed to the server. instead of passing the coords to a .map file
    pass them to a script. get the script to do whatever it is you need
    doing.

    > that aren't ASP


    asp is the spawn of beelzebub

    > (because I'll have to port it to Solaris later; see above) or C++


    haven't touched c/c++ since the late '80s.

    --
    b r u c i e
     
    brucie, Apr 1, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWlrZUppbmdKaW5n?=

    HELP Access DB, ASP.NET 2.0 and whole lot of pain

    =?Utf-8?B?TWlrZUppbmdKaW5n?=, Dec 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    476
    Patrice
    Dec 6, 2005
  2. motoman
    Replies:
    0
    Views:
    454
    motoman
    Oct 15, 2004
  3. Replies:
    5
    Views:
    386
    Steve Holden
    Feb 23, 2009
  4. Replies:
    0
    Views:
    742
  5. Replies:
    1
    Views:
    563
Loading...

Share This Page