最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

div隨鼠標(biāo)移動(dòng)

2022-11-13 13:18 作者:酸奶公園  | 我要投稿

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<style type="text/css">

#box1{

width: 100px;

height: 100px;

background-color: red;

position: absolute;

}


</style>


</head>

<body style="height: 500000px;width: 50000px;">

<div id="box1"></div>

<script>

var box1 = document.getElementById("box1");

document.onmousemove=function(){

box1.style.left=event.clientX+"px";

box1.style.top=event.clientY+"px";

}

</script>

</body>

</html>

更改li內(nèi)容

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

</head>

<body>

<ul>

<li>第1列</li>

<li>第2列</li>

<li>第3列</li>

<li>第4列</li>

<li>第5列</li>

<li>第6列</li>

<li>第7列</li>

<li>第8列</li>

<li>第9列</li>

<li>第10列</li>

</ul>

<script>

var lilist = document.getElementsByTagName("li");

for(var i=0;i<lilist.length;i++)

{

if(i%2==0) lilist[i].innerHTML="奇數(shù)行";

else lilist[i].innerHTML="偶數(shù)行";

}

</script>

</body>

</html>

圖片切換


<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

</head>

<body>

<img src="image/a.jpg" />

<br/>

<button>上一張</button>

<button>下一張</button>

</body>

<script>

var prebtn = document.getElementsByTagName("button")[0];

var nextbtn = document.getElementsByTagName("button")[1];

var img = document.getElementsByTagName("img")[0];

imglist = ["image/a.jpg","image/b.jpg","image/c.jpg","image/d.jpg","image/e.png","image/f.jpg"]

var index=0;

prebtn.onclick = function(){

index--;

if(index<0) index=imglist.length-1;

img.src=imglist[index];

}

nextbtn.onclick = function(){

index++;

if(index>=imglist.length) index=0;

img.src=imglist[index];

}

</script>

</html>

移動(dòng)div


<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<style>

*{

padding: 0;

margin: 0;

}

#box1{

width: 100px;

height: 100px;

background-color: red;

position: absolute;

left: 0;

}

</style>

</head>

<body>

<button id="btn">單擊開始</button>

<div id="box1"></div>

<script>

var btn=document.getElementById("btn");

var box=document.getElementById("box1");

btn.onclick=function(){

var move = function(){

var nv=box.offsetLeft+10;

box.style.left = nv+"px";

}

setInterval(move,30);

}

</script>

</body>

</html>


div隨鼠標(biāo)移動(dòng)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
郎溪县| 邻水| 邵阳县| 丹阳市| 清水县| 精河县| 隆安县| 股票| 仪征市| 锦州市| 静乐县| 杭锦后旗| 兰溪市| 白山市| 乐亭县| 阿克苏市| 集安市| 黔南| 太保市| 凤庆县| 尖扎县| 绥江县| 乌拉特后旗| 德州市| 大冶市| 盘山县| 萍乡市| 灯塔市| 名山县| 吕梁市| 合江县| 新余市| 同德县| 武威市| 青河县| 峡江县| 诸暨市| 建水县| 金阳县| 梅州市| 陆河县|