亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

關于clientY

list.onmousedown=function(event){

?touchstartX=event.clientX;

? ? ? touchstartY=event.clientY;

?console.log("開始"+touchstartY);

?}

list.onmousemove=function(event){

touchendX=event.clientX;

? ? ? touchendY=event.clientY;

?console.log("移動"+touchendY);


?}

?

? ? list.onmouseup=function(event){

?console.log("結束"+event.clientY);

?}

這么寫 為什么只顯示 開始的 clientY ?。onmousemove?onmouseup 都不起作用


正在回答

2 回答

<div id="div1"></div> 換成圖片 還是不行哎 為什么?。?/p>

0 回復 有任何疑惑可以回復我~

<!doctype html>
<html>
<head>
??? <meta charset="UTF-8">
?? ?<title>Document</title>
?? ?<style>
?? ?#div1{
?? ??? ?background-color:#ccc;
?? ??? ?height:400px;
?? ??? ?width:300px;
?? ??? ?}?? ?
?? ?</style>
?? ?<script>
?? ??? ?window.onload=function(){
?? ??? ??? ?var list = document.getElementById('div1');
?? ??? ??? ?var flag = 0;
?? ??? ?list.onmousedown=function(event){
?? ??? ??? ?touchstartX=event.clientX;
? ?? ? ??? ?touchstartY=event.clientY;
?? ??? ??? ??? ?console.log("開始"+touchstartY);
?? ??? ??? ??? ?flag=1;
??? ??? ??? ?}?? ??? ??? ?
?? ??? ??? ?list.onmousemove=function(event){
?? ??? ??? ??? ?touchendX=event.clientX;
??? ? ?? ???? touchendY=event.clientY;
??? ? ?? ???? if(flag==1){
??? ??? ??? ??? ?console.log("移動"+touchendY);
??? ??? ??? ??? ?}
??? ??? ??? ?}
?? ??? ??? ?list.onmouseup=function(event){
?? ??? ??? ??? ?console.log("結束"+event.clientY);
?? ??? ??? ??? ?flag=0;
??? ??? ??? ?} ?
??? ??? ?}?? ?
?? ?</script>
</head>
<body>
?? ?<div id="div1"></div>
</body>
</html>

0 回復 有任何疑惑可以回復我~
#1

愛梯噠小怪獸 提問者

<div id="div1"></div> 換成圖片 還是不行哎 為什么?。?/div>
2016-02-24 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
DOM事件探秘
  • 參與學習       99534    人
  • 解答問題       1305    個

DOM事件?本課程會通過實例來給小伙伴們講解如何使用這些事件

進入課程

關于clientY

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號