侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

dedecms实现首页顶部会员登陆框的方法

框架(架构)  /  管理员 发布于 7年前   173

很多做网站的人在做门户资讯网站的时候,都喜欢在首页顶部的位置来个横向的会员登陆。而dede的会员登陆则是在右边的。那到底要如何来实现这个功能呢?请先看效果图。
 
下面我们来一步一步修改!
首先在index.html中删掉原来的登陆代码,在头部文件head.html加入以下新的代码:

复制代码代码如下:
<div class="header_top">
<div class="w960 center">
<span class="time" id="time">
<table border="0" align="center" >
<tr><td>
<div id="_userlogin">
<div class="userlogin">
<form name="userlogin" action="{dede:global.cfg_memberurl/}/index_do.php" method="POST">
<input type="hidden" name="fmdo" value="login" />
<input type="hidden" name="dopost" value="login" />
<input type="hidden" name="keeptime" value="604800" />
<div class="fb">用户名:<input type="text" name="userid" size="18" class="ipt-txt" />
密码:<input type="password" name="pwd" size="18" class="ipt-txt" />
验证码:<input type="text" name="vdcode" size="8" class="ipt-txt" />
<img align="center" src="https:/cms/{dede:global.cfg_cmsurl/}/include/vdimgck.php" />
<button type="submit" class="btn-1">登录</button>
<a href="https:/cms/{dede:global.cfg_memberurl/}/index_do.php?fmdo=user&dopost=regnew">注册帐号</a> <a href="https:/cms/{dede:global.cfg_memberurl/}/resetpassword.php">忘记密码?</a>
</form>
</div>
</div>
<!-- /userlogin -->
<script language="javascript" type="text/javascript">CheckLogin();</script>
</td></tr></table>
</span>
<div class="toplinks"><a href="https:/cms/"onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('{dede:global.cfg_basehost/}');">设为首页</a> | <a href="'{dede:global.cfg_basehost/}','{dede:global.cfg_webname/}')">加入收藏</a> | <a href="https:/cms/{dede:global.cfg_cmsurl/}/data/sitemap.html" target="_blank">网站导航</a> | <a href="https://">联系我们</a></div>
</div>
</div>

HTML代码现在我们已经有了,下面把上面代码中用到的CSS样式完善了:

复制代码代码如下:
/*---------- head ---------*/
.header{
width:100%;
width:960px;
margin:auto;
overflow:hidden;
}
.header_top{
height:32px!important;
height:31px;
line-height:32px;
color:#676767;
overflow:hidden;
background:url(../images/top_bg.gif) repeat-x;
}
.center{
margin:0px auto;
}
.w960{
width:960px;
/*position:relative;*/
}
.header_top .time{
float:left;
padding-left:10px;
}
.header_top .toplinks{
float:right;
text-align:right;
}
.header_top .toplinks a{
margin:0 5px;
}
.header .top{
clear:both;
overflow:hidden;
margin-top:10px;
}
.header .title{
float:left;
}
.header .title h1 a{
width:386px;
height:58px;
display:block;
overflow:hidden;
}
.header .banner{
width:434px;
height:55px;
float:right;
margin-left:20px;
overflow:hidden;
}
.ipt-txt{
width:100px;
border:1px #CFCFCF solid;
}
.fb{
color:#333333;
}
.btn-1{
background: url("../images/comm-bt.gif") no-repeat scroll 0 0 transparent;
border: medium none;
color: #585858;
cursor: pointer;
height: 24px;
letter-spacing: 1px;
line-height: 25px;
overflow: hidden;
width: 70px;
}

HTML代码和CSS都有了,现在显示是没问题了,但要正常登入,还少一些JS文件要加载:

复制代码代码如下:
<script language="javascript" type="text/javascript" src="https:/cms/{dede:global.cfg_cmsurl/}/include/dedeajax2.js"></script>
<script language="javascript" type="text/javascript">
<!--
$(function(){
$("a[_for]").mouseover(function(){
$(this).parents().children("a[_for]").removeClass("thisclass").parents().children("dd").hide();
$(this).addClass("thisclass").blur();
$("#"+$(this).attr("_for")).show();
});
$("a[_for=uc_member]").mouseover();
$("a[_for=flink_1]").mouseover();
});
function CheckLogin(){
var taget_obj = document.getElementById('_userlogin');
myajax = new DedeAjax(taget_obj,false,false,'','','');
myajax.SendGet2("{dede:global.cfg_cmspath/}/member/ajax_loginsta.php");
DedeXHTTP = null;
}
-->
</script>


  • 上一条:
    织梦dedecms站点data目录位置变动调整验证码不显示的解决办法
    下一条:
    360提示DedeCms全局变量覆盖漏洞(临时解决方法)
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • Filament v3.1版本发布(0个评论)
    • docker + gitea搭建一个git服务器流程步骤(0个评论)
    • websocket的三种架构方式使用优缺点浅析(0个评论)
    • ubuntu20.4系统中宿主机安装nginx服务,docker容器中安装php8.2实现运行laravel10框架网站(0个评论)
    • phpstudy_pro(小皮面板)中安装最新php8.2.9版本流程步骤(0个评论)
    • 近期文章
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • PHP 8.4 Alpha 1现已发布!(0个评论)
    • Laravel 11.15版本发布 - Eloquent Builder中添加的泛型(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2018-05
    • 2020-02
    • 2020-03
    • 2020-05
    • 2020-06
    • 2020-07
    • 2020-08
    • 2020-11
    • 2021-03
    • 2021-09
    • 2021-10
    • 2021-11
    • 2022-01
    • 2022-02
    • 2022-03
    • 2022-08
    • 2023-08
    • 2023-10
    • 2023-12
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客