Hi,

I'm displaying a geographical map, which is divided in sectors, as apposed to counties, which are more recognisable off course. Therefore I want to display the names of the towns for the particular sector, which has the mouse arrow over it, so that the sector will make more sense to those viewing them. So far I have managed to get the coordinates of the mouse arrow and display them on the screen, by using onmousemove.

What I want next, is use a perl function at the server side to receive a set of coords from the client and send back to them a list of towns for this sector. This will also check if a new list needs to be sent - because the mouse arrow might still cover the same county.

First off, can I call a perl function from within a javascript function - the javascript function that is associated with onmousemove. How will the returned list be accessible to the calling function?

Second off, is this a stupid way of achieving what I want to do. What other ways might it be done? Remember that all the pixels in the map need to be associated with a sector.

The way I plan to this this would be to create a second map and give each sector a unique color.

In reply to Calling a perl function from within a javascript function by Baz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.