Re: possible jscript/php/frames question!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Saturday, June 18, 2005, 8:47:58 AM, you wrote:
b> hi...

b> i've got a problem where i'm trying to play with imagemaps. i created a test
b> image map, but when i select inside the image map, i 'see' the "?x,y" from
b> the imagemap, appended to the url in the browser address bar... i get
b> http://foo.com?3,5 etc...

b> is there a way to prevent this from occuring??

b> i'd like to be able to select the imagemap, get the coordinate, and not have
b> the x,y mouse coordinate show up in the address bar...

b> i thought i could use an onClick, and go to a javascript function, but i
b> couldn't figure out how to get the mouse coordinates within the jscript
b> function.

b> if i slammed all this inside a frame, would that prevent the url-"x,y"
b> information from being displayed??

b> my sample code is below...

b> thanks

b> -bruce
b> bedouglas@xxxxxxxxxxxxx


b> ----------------------------------------------------------------------------
b> ---
b> [root@lserver4 site]# cat map.php
b> <?
b>   /*
b>      test for image maps...
b>   */
?>>
b> <?
b>  $_self = $_SERVER['PHP_SELF'];
?>>

b> <html>
b> <body>
b> <script language="javascript" type="text/javascript">
b> <!--

b> function foo1(q)
b> {
b> //   str = window.location.search
b> //   document.write("fff "+q+"<br>");
b> // location.href="map.php";
b> // return true;
b> }
b> function foo(e)
b> {
b> //q = q+1;
b>  mX = event.clientX;
b>  mY = event.clientY;
b> //   str = window.location.search
b>    document.write("fff "+mX+" y= "+mY+"<br>");
b>  location.href="map.php";
b>  return true;
b> }
// -->>
b> </script>

b> <!--
b> <center><a href="<?=$_self;?>"><img
-->>

b> <center>
b> <!--
b> <a href="<?=$_self;?>" onclick ="alert(self.location.search); return false">
-->>
b> <a href="ff.php" onclick="">
b> <img src="imagemap.gif" ISMAP></a></center>
b> <p>
b> <script language="javascript" type="text/javascript">
b> <!--

b> str = location.search
b>  if(str)
b>  {
b>    document.write("fff "+str+"<br>");
b>    //location.href="map.php";
b>  }

// -->>
b> </script>


b> </body>
b> </html>

A PHP solution to your problem is to save the x y co-ordinates in a
session and do a refresh, then get the values fom session.

Do something like

<?php
session_start();
if(isset($_SESSION['x']) && isset($_SESSION['y'])){
  //do your thing here
  unset($_SESSION['x'];
  unset($_SESSION['y'];
}else{
  //get x and y from request variables here
  if($x && $y){
    $_SESSION['x'] = $x;
    $_SESSION['y'] = $y;
    header('location: '.$_SERVER['PHP_SELF']);
    exit;
  }else{
    //show start page
  }
}
-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux