QQ好友界面_qq怎么群发消息给好友列表

QQ好友界面_qq怎么群发消息给好友列表效果如下:依次为图一图二图三图四主要实现效果:点击主标题显示下拉好友,再点击收起下拉好友;鼠标移到好友上背景颜色改变;选中的好友背景颜色也要改变;代码如下:<!DOCTYPEht

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

效果如下:依次为图一—图二—-图三—-图四

QQ好友界面_qq怎么群发消息给好友列表QQ好友界面_qq怎么群发消息给好友列表QQ好友界面_qq怎么群发消息给好友列表QQ好友界面_qq怎么群发消息给好友列表

 

主要实现效果:

点击主标题显示下拉好友,再点击收起下拉好友;鼠标移到好友上背景颜色改变;选中的好友背景颜色也要改变;

 

代码如下:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>无标题文档</title>

<style type=”text/css”>
*{ margin:0px auto;
padding:0px;
font-family:微软雅黑;
font-size:14px;
}
.zhu{ width:200px;
height:30px;
text-align:center;
line-height:30px;
vertical-align:middle;
background-color:#03C;
color:white;
}
.zi{ width:200px;
display:none}
.list{ width:198px;
height:30px;
text-align:left;
line-height:30px;
vertical-align:middle;
border-left:1px solid #999;
border-right:1px solid #999;
}
.kg{
margin-left: 30px;
}
.kg1{
margin-left: 10px;
}
.list:hover{
cursor: pointer;
}

#z4{ border-bottom:1px solid #999;}
</style>

</head>
<body>
<div style=”width:200px; height:600px; margin-top:30px”>
<div class=”zhu” onclick=”Show(‘z1’)”>
我的好友
</div>
<div class=”zi” id=”z1″>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>张三</span></div>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>李四</span></div>
</div>
<div class=”zhu” onclick=”Show(‘z2’)”>
特别关注
</div>
<div class=”zi” id=”z2″>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>王五</span></div>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>陈六</span></div>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>刘二</span></div>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>韩七</span></div>
</div>
<div class=”zhu” onclick=”Show(‘z3’)”>
陌生人
</div>
<div class=”zi” id=”z3″>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>王四</span></div>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>陈三</span></div>
</div>
<div class=”zhu” onclick=”Show(‘z4’)”>
黑名单
</div>
<div class=”zi” id=”z4″>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>刘二</span></div>
<div class=”list” onclick=”Xuan(this)” onmouseover=”Bian(this)” onmouseout=”Hui(this)” xz=”0″><span class=”kg”>韩七</span></div>
</div>
</div>
</body>
<script type=”text/javascript”>

function Show(id)     //作用是收起或显示下拉好友
{

var z = document.getElementById(id);

if(z.style.display==”block”)
{
z.style.display = “none”;
}
else
{
z.style.display = “block”;
}
}

 

function Xuan(a)                  //作用是点击好友,好友背景颜色改变
{
var attr = document.getElementsByClassName(“list”);

for(var i=0;i<attr.length;i++)
{
attr[i].style.backgroundColor = “white”;
attr[i].setAttribute(“xz”,”0″);
}
a.setAttribute(“xz”,”1″);            //自定义属性,将XZ属性添加给选中的div
a.style.backgroundColor = “#F63”;
}

function Bian(a)            //作用:鼠标移上背景颜色发生改变
{
var attr = document.getElementsByClassName(“list”);

for(var i=0;i<attr.length;i++)
{
if(attr[i].getAttribute(“xz”)==”0″)
{
attr[i].style.backgroundColor = “white”;
}
}

a.style.backgroundColor = “#F63”;
}

function Hui(a)           //作用是鼠标移走时,背景颜色取消
{
var attr = document.getElementsByClassName(“list”);

for(var i=0;i<attr.length;i++)
{
if(attr[i].getAttribute(“xz”)==”0″)
{
attr[i].style.backgroundColor = “white”;
}
}
}

</script>
</html>

 

注意:

1、自定义函数运用的形参;

2、为什么不用hover属性,而用onmouseover,onmouseout属性:内嵌样式在js中无法读取。

3、this表示:选中的本div

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/168044.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号