Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Frames and Javascript (Oh, the pain!)

Reply
Thread Tools

Frames and Javascript (Oh, the pain!)

 
 
Owen Jacobson
Guest
Posts: n/a
 
      04-01-2004
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.

 
Reply With Quote
 
 
 
 
brucie
Guest
Posts: n/a
 
      04-01-2004
in post: <newsan.2004.04.01.00.24.57.430507@lionsanctuary .net>
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
 
Reply With Quote
 
 
 
 
Owen Jacobson
Guest
Posts: n/a
 
      04-01-2004
On Thu, 01 Apr 2004 10:47:16 +1000, brucie wrote:

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

> in post: <newsan.2004.04.01.00.24.57.430507@lionsanctuary .net>
> 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.

 
Reply With Quote
 
Jeff Thies
Guest
Posts: n/a
 
      04-01-2004
> 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.
>



 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      04-01-2004
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.


 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      04-01-2004
in post: <newsan.2004.04.01.02.08.59.779127@lionsanctuary .net>
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
having a problem with scrolling frames as if no frames surfunbear@yahoo.com HTML 0 03-08-2006 09:54 PM
Frames and borders around specific frames meyousikmann@yahoo.com HTML 1 02-10-2006 11:12 PM
Frames or not Frames... Ale HTML 17 08-05-2005 12:10 AM
Link needed to go from a non-frames page to a Frames page, and load a particular frame. How? - Newbe Philip HTML 3 06-28-2004 03:06 PM
From Frames to no frames? Powerslave2112 HTML 2 01-20-2004 10:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57