SHARE
TWEET

hehe

a guest Jul 18th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script src="jquery-3.4.1.min.js">
  2. <!--
  3.  
  4.  
  5. var IE = document.all?true:false
  6. if (!IE) document.captureEvents(Event.MOUSEMOVE)
  7. document.onmousemove = getMouseXY;
  8. var tempX = 0
  9. var tempY = 0
  10. function getMouseXY(e) {
  11.  if (IE) {
  12.    tempX = event.clientX + document.body.scrollLeft
  13.    tempY = event.clientY + document.body.scrollTop
  14.  } else {  
  15.    tempX = e.pageX
  16.    tempY = e.pageY
  17.  }  
  18.  
  19.  if (tempX < 0){tempX = 0}
  20.  if (tempY < 0){tempY = 0}  
  21.  
  22.  document.Show.MouseX.value = tempX
  23.  document.Show.MouseY.value = tempY
  24.  return true
  25. }
  26.  
  27. function a(){
  28.  var x = document.createElement("IMG");
  29.  x.attr("id","cam")
  30.  x.setAttribute("src", "cam.jpg");
  31.  x.setAttribute("width", "30");
  32.  x.setAttribute("height", "30");  document.body.appendChild(x);
  33.  
  34.    document.getElementById("tx").innerHTML=tempX;
  35.    document.getElementById("ty").innerHTML=tempY;
  36.   if ( confirm ("確定儲存攝影機位置? ") )
  37.     { alert("儲存成功 " )    }
  38.    
  39. }
  40.  
  41. //-->
  42. </script>
  43.  
  44. <style type="text/css">
  45.     cam{
  46.         position: absolute;
  47.         left: 110px;
  48.         top: 150px;
  49.         z-index: 0;
  50.     }
  51. </style>
  52. <body>
  53. <form name="Show">
  54. <p align="center"><input type="text" name="MouseX" value="0" size="4">X <input type="text" name="MouseY" value="0" size="4">Y </form>      
  55. <button onclick="a()"><img src="example01.jpg"></button>
  56. <br>
  57. <a>上次座標</a><div id = "tx"></div><div id = "ty"></div>
  58. </body>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top