dedecms实现首页顶部会员登陆框的方法
2024-07-12 08:28:57
供稿:网友
很多做网站的人在做门户资讯网站的时候,都喜欢在首页顶部的位置来个横向的会员登陆。而dede的会员登陆则是在右边的。那到底要如何来实现这个功能呢?请先看效果图。 下面我 标签: 很多做网站的人在做门户资讯网站的时候,都喜欢在首页顶部的位置来个横向的会员登陆。而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="{dede:global.cfg_cmsurl/}/include/vdimgck.php" /> <button type="submit" class="btn-1">登录</button> <a href="{dede:global.cfg_memberurl/}/index_do.php?fmdo=user&dopost=regnew">注册帐号</a> <a href="{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=""onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('{dede:global.cfg_basehost/}');">设为首页</a> | <a href="javascript:window.external.AddFavorite('{dede:global.cfg_basehost/}','{dede:global.cfg_webname/}')">加入收藏</a> | <a href="{dede:global.cfg_cmsurl/}/data/sitemap.html" target="_blank">网站导航</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;