How do I get click coordinates from imagemap

G

Guest

Guest
Archived from groups: microsoft.public.pocketpc (More info?)

I have written this code:

<form name="image_pointer" id="image_pointer" method="get"
action="image_check.php">
<input type='image' src="images/GLOBAL_240.jpg" height="210" width="238"
border="0" alt="Map of Earth" ISMAP /></a></td>
</form>

On most browsers a click on the image creates a call to
'image_check.php?x=99&y=99' (where the '99's depend on whee you clicked)
and I can $_GET['x'] and $_GET['y'] in 'image_check.php.

On a PocketPC the same code produces the call as simply "image_check.php?"
without the coordinates. Is there a way to pass the coordinates from the
PIE browser?
 
G

Guest

Guest
Archived from groups: microsoft.public.pocketpc (More info?)

OK you didn't state which version of Pocket PC and therfore pocket IE
you're using. I'll assume you are using WM2003.

Now the thing is, the documentation for ISMAP states that x and y are
not explicitly passed (the x and y are passed when you click a button
or image form element however).

Why dont you go to your PHP page and try

<?php
print_r($_GET);
?>

You'll see the coordinates *are* passed, and they appear as a comma
separated pair which you can extract thus :

<?php
$input=array_keys($_GET);
$coords = explode(',', $input[0]);
print("X coordinate : ".$coords[0]." Y Coordinate :
".$coords[1]);
?>

Interestingly another possible apparoach using event.clientX fired
from onclick events on either the image or a surrounding anchor,
doesn't work. Although PIE for WM2003 uses Javascript1.3, it doesn't
appear to support the event model at all that desktop browsers use.

Otherwise I'd have suggested setting hidden form elements x and y with
the event.clientX and event/clientY coordinates.

Anyway, it works.
Cheers - Neil


On Wed, 25 Aug 2004 09:16:19 -0700, samson@livingtext.com (Perry)
wrote:

>I have written this code:
>
><form name="image_pointer" id="image_pointer" method="get"
>action="image_check.php">
> <input type='image' src="images/GLOBAL_240.jpg" height="210" width="238"
>border="0" alt="Map of Earth" ISMAP /></a></td>
></form>
>
>On most browsers a click on the image creates a call to
>'image_check.php?x=99&y=99' (where the '99's depend on whee you clicked)
>and I can $_GET['x'] and $_GET['y'] in 'image_check.php.
>
>On a PocketPC the same code produces the call as simply "image_check.php?"
>without the coordinates. Is there a way to pass the coordinates from the
>PIE browser?
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.pocketpc (More info?)

Sorry I meant to post the HTML code required !!

<a href="image_check.php"><img src="wmptoexcel.gif" width="80"
height="167" border="1" ismap="ismap"></a>

Cheers - Neil

On Wed, 25 Aug 2004 09:16:19 -0700, samson@livingtext.com (Perry)
wrote:

>I have written this code:
>
><form name="image_pointer" id="image_pointer" method="get"
>action="image_check.php">
> <input type='image' src="images/GLOBAL_240.jpg" height="210" width="238"
>border="0" alt="Map of Earth" ISMAP /></a></td>
></form>
>
>On most browsers a click on the image creates a call to
>'image_check.php?x=99&y=99' (where the '99's depend on whee you clicked)
>and I can $_GET['x'] and $_GET['y'] in 'image_check.php.
>
>On a PocketPC the same code produces the call as simply "image_check.php?"
>without the coordinates. Is there a way to pass the coordinates from the
>PIE browser?
>
>
 

RC

Distinguished
Mar 31, 2004
8
0
18,510
Archived from groups: microsoft.public.pocketpc (More info?)

you can use code like this:
<input name="myimage" type='image'
src="images/GLOBAL_240.jpg" height="210" width="238"
border="0" alt="Map of Earth" />

add a "name" attribute.
then the url will show coordinates .
url?myimage.x=2&myimage.y=4

have a try.