首页 > 其他 > 详细

6.4

时间:2020-06-05 19:38:52      阅读:41      评论:0      收藏:0      [点我收藏+]

1.日历

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
* { padding: 0; margin: 0; }
li { list-style: none; }
body { background: #f6f9fc; font-family: arial; }

.calendar { width: 210px; margin: 50px auto 0; padding: 10px 10px 20px 20px; background: #eae9e9; }
.calendar ul { width: 210px; overflow: hidden; padding-bottom: 10px; }
.calendar li { float: left; width: 58px; height: 54px; margin: 10px 10px 0 0; border: 1px solid #fff; background: #424242; color: #fff; text-align: center; cursor: pointer; }
.calendar li h2 { font-size: 20px; padding-top: 5px; }
.calendar li p { font-size: 14px; }

.calendar .active { border: 1px solid #424242; background: #fff; color: #e84a7e; }
.calendar .active h2 { }
.calendar .active p { font-weight: bold; }

.calendar .text { width: 178px; padding: 0 10px 10px; border: 1px solid #fff; padding-top: 10px; background: #f1f1f1; color: #555; }
.calendar .text h2 {font-size: 14px; margin-bottom: 10px; }
.calendar .text p { font-size: 12px; line-height: 18px; }
</style>
</head>

<body>
<div id="tab" class="calendar">

<ul>
<li class="active" nn="1"><h2>1</h2><p>JAN</p></li>
<li nn="2"><h2>2</h2><p>FER</p></li>
<li nn="3"><h2>3</h2><p>MAR</p></li>
<li nn="4"><h2>4</h2><p>APR</p></li>
<li nn="5"><h2>5</h2><p>MAY</p></li>
<li nn="6"><h2>6</h2><p>JUN</p></li>
<li nn="7"><h2>7</h2><p>JUL</p></li>
<li nn="8"><h2>8</h2><p>AUG</p></li>
<li nn="9"><h2>9</h2><p>SEP</p></li>
<li nn="10"><h2>10</h2><p>OCT</p></li>
<li nn="11"><h2>11</h2><p>NOV</p></li>
<li nn="12"><h2>12</h2><p>DEC</p></li>
</ul>

<div class="text">
<h2>1月活动</h2><p>这是1月活动内容</p>
</div>

</div>
</body>
<script type="text/javascript">
window.onload=function(){
var lis=document.getElementById("tab").getElementsByTagName("li");
for(var i=0;i<lis.length;i++){
lis[i].onmouseover=over;
lis[i].onmouseout=out;
}
}
function over(){
this.className="active";
var nn=this.getAttribute("nn");
var content="<h2>"+nn+"月活动</h2><p>这是"+nn+"月活动内容</p>";
var dd=document.getElementsByClassName("text")[0];
dd.innerHTML=content;

}
function out(){
this.className="";
}
</script>
</html>

 

2、‘轮播图

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<img src="img/1.jpg" id="imge" onMouseMove="jieshu()" onMouseOut="kaishi()">
<input type="button" value="上一页" onClick="up()">
<input type="button" value="1" onClick="change(this)">
<input type="button" value="2" onClick="change(this)">
<input type="button" value="3" onClick="change(this)">
<input type="button" value="4" onClick="change(this)">
<input type="button" value="5" onClick="change(this)">
<input type="button" value="6" onClick="change(this)">
<input type="button" value="7" onClick="change(this)">
<input type="button" value="8" onClick="change(this)">
<input type="button" value="下一页" onClick="next()">
</body>
<script type="text/javascript">
var imgs=["img/1.jpg","img/2.jpg","img/3.jpg","img/4.jpg","img/5.jpg","img/6.jpg","img/7.jpg","img/8.jpg"];
var img=document.getElementById("imge");
var index=0;
var lunbo=null;
kaishi();
function change(obj){
index=obj.value-1;
img.src=imgs[index];

}
function next(){
if(index==imgs.length-1){
index=0;
}else{
index++;
}
img.src=imgs[index];
}
function up(){
if(index==0){
index=imgs.length
}else{
index--;
}
img.src=imgs[index];
}
function kaishi(){
lunbo=setInterval(next,2000);
}
function jieshu(){
clearInterval(lunbo);
}
</script>
</html>

 

3.jquery

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script type="text/javascript" src="jquery-3.5.1.min.js"></script>
<script type="text/javascript">


// window.onload=function(){
// var p1=document.getElementById("p1").innerHTML;
// console.log(p1);
// }
$(function(){
var p1=$("#p1").html();
console.log(p1);
var p2=$(".p2:first").html();
console.log(p2);
var p3=$("#p3").html();
console.log(p3);
var a=$("[href]").eq(0).html();
console.log(a);
var a2=$("[href=‘baidu‘]").html();
console.log(a2);
$("#p1").html("卢志金");
})
</script>
</head>

<body>
<p id="p1">海绵宝宝</p>
<p class="p2">派大星</p>
<p class="p2">章鱼哥</p>
<div id="p3">光头强</div>
<a href="#">本页</a>
<a href="baidu">百度</a>
</body>
</html>

 

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
div{
color: red;
}
</style>
<script type="text/javascript" src="jquery-3.5.1.min.js"></script>
<script type="text/javascript">
$(function(){
$("#uname").blur(function(){
var uname=$("#uname").val();
console.log(uname);
});
$("#pwd").val("woshinidie");
console.log($("#pwd").val());
$("div:first").css("color","yellow");
$("div:first").css({
"width":"2000px",
"height":"2000px",
"background":"pink"

});

var back=$("div:first").css("background");
console.log(back);

})

</script>
</head>

6.4

原文:https://www.cnblogs.com/LNH2019/p/13051270.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!