<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<style>
.box{
width:100px;
height:100px;
position: absolute;
top:30px;
left:50px;
border: 1px solid #666;
background-color: #999999;
}
</style>
</head>
<body>
<button onclick="f()">点我变红</button>
<p>文字</p>
<p>文字</p>
<p>文字</p>
<p>文字</p>
<p>文字</p>
<div id="editcolor">change</div>
<ul>
<li>元素1</li>
<li>元素2</li>
<li>元素3</li>
<li>元素4</li>
<li>元素5</li>
</ul>
<button id="btn1">右移</button>
<button id="btn2">左移</button>
<div class="box"></div>
<script>
function f() {
var pArray=document.getElementsByTagName("p");
for (var i=0;i<pArray.length;i++){
pArray[i].style.cssText="border: 1px solid red";
}
}
var people={
sex:"男",
age:20,
say1: function () {
alert("我要上班");
},
say2: function () {
alert("一个哈麻批");
}
}
var num=prompt();
isfalse=false;
for(var i=2;i<num;i++) {
if (num % i == 0) {
isfalse = true;
break;
}
}
if(num==1)
alert("既不是素数也不是合数");
else{
if(isfalse==true)
alert("合数");
else if (isfalse==false)
alert("素数");
}
$("#editcolor").css("background","red");
$("#editcolor").html("子元素");
$("p").eq("1").css("background","red")
$("ul li:last").remove()
$('p').click(function(){
alert($(this).index())
})
$("#btn1").click(function () {
$('.box').animate({
"left":"+=100px"
});
});
$("#btn2").click(function () {
$('.box').animate({
"left":"-=100px"
});
});
</script>
</body>
</html>
idealist 9.18 web作业
最新推荐文章于 2022-03-15 09:46:51 发布