Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="jquery-3.4.1.min.js">
- <!--
- var IE = document.all?true:false
- if (!IE) document.captureEvents(Event.MOUSEMOVE)
- document.onmousemove = getMouseXY;
- var tempX = 0
- var tempY = 0
- function getMouseXY(e) {
- if (IE) {
- tempX = event.clientX + document.body.scrollLeft
- tempY = event.clientY + document.body.scrollTop
- } else {
- tempX = e.pageX
- tempY = e.pageY
- }
- if (tempX < 0){tempX = 0}
- if (tempY < 0){tempY = 0}
- document.Show.MouseX.value = tempX
- document.Show.MouseY.value = tempY
- return true
- }
- function a(){
- var x = document.createElement("IMG");
- x.attr("id","cam")
- x.setAttribute("src", "cam.jpg");
- x.setAttribute("width", "30");
- x.setAttribute("height", "30"); document.body.appendChild(x);
- document.getElementById("tx").innerHTML=tempX;
- document.getElementById("ty").innerHTML=tempY;
- if ( confirm ("確定儲存攝影機位置? ") )
- { alert("儲存成功 " ) }
- }
- //-->
- </script>
- <style type="text/css">
- cam{
- position: absolute;
- left: 110px;
- top: 150px;
- z-index: 0;
- }
- </style>
- <body>
- <form name="Show">
- <p align="center"><input type="text" name="MouseX" value="0" size="4">X <input type="text" name="MouseY" value="0" size="4">Y </form>
- <button onclick="a()"><img src="example01.jpg"></button>
- <br>
- <a>上次座標</a><div id = "tx"></div><div id = "ty"></div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement