zoukankan      html  css  js  c++  java
  • 牛腩新闻发布系统——后台前台整合技术

    在牛腩新闻发布系统中用到了一些技术我就来总结下

    一、鼠标超链接设置

             一开始就用到了鼠标超链接的设置。尾部样式的设置,这个东西每个网站都要用到非常长用所以可以写下来积累积累。

    举个例子

    如图:鼠标没有移上去的样子为

    鼠标移上去的样子为:

    字体变蓝出现下划线

    怎么做到的呢?

    我用C#开发的在.aspx文件中的代码为:

     <div id="footer">版权所有©<a  href ="http://blog.163.com/gwblue(at)yeah"target="_blank">高玮a</a>&信息技术提高班
    </div>
    

           CSS文件中:

    a:link,a:visited
    {  /*未访问连接时候的样式*/
        color: #000;
        text-decoration :none;
            }   
    a:hover 
    {  /*当有鼠标悬停在链接上 */
         color:#00f;
             text-decoration:underline;
        }  
    


     

    二、.NET截取制定长度汉字超出部分以“…”代替

    CS代码:

      ///   <summary>    
        ///   将指定字符串按指定长度进行剪切,    
        ///   </summary>    
        ///   <param   name= "oldStr "> 需要截断的字符串 </param>    
        ///   <param   name= "maxLength "> 字符串的最大长度 </param>    
        ///   <param   name= "endWith "> 超过长度的后缀 </param>    
        ///   <returns> 如果超过长度,返回截断后的新字符串加上后缀,否则,返回原字符串 </returns>    
        public static string StringTruncat(string oldStr, int maxLength, string endWith)
        {
            if (string.IsNullOrEmpty(oldStr))
                //   throw   new   NullReferenceException( "原字符串不能为空 ");    
                return oldStr + endWith;
            if (maxLength < 1)
                throw new Exception("返回的字符串长度必须大于[0] ");
            if (oldStr.Length > maxLength)
            {
                string strTmp = oldStr.Substring(0, maxLength);
                if (string.IsNullOrEmpty(endWith))
                    return strTmp;
                else
                    return strTmp + endWith;
            }
            return oldStr;
    }   
    


     

     

    Aspx代码:

     

     <asp:TemplateField HeaderText="新闻标题">
                                    <ItemTemplate>
                                        <a href ='newscontent.aspx?newsid=<%# Eval("id") %>' target ="_blank" title='<%# Eval("title") %>'><%# StringTruncat(Eval("title").ToString(),18,"...") %></a>
                                    </ItemTemplate>
                                </asp:TemplateField>
    


     

    三、把IP的最后一位弄成*

    <p class ="replay_info"> 
                        <asp:LinkButton ID="lbtnDelComment"  OnClientClick ="return confirm('是否真的删除该评论!?')"  OnClick ="lbtnDelComment_Click"  CommandArgument ='<%# Eval ("id") %>' runat="server" Visible ="false" >删除 </asp:LinkButton>
                   评论者:<%# Eval ("userIp").ToString ().Substring(0,Eval ("userIp").ToString().LastIndexOf (".") +1) +"*"%>评论时间 :<%# Eval ("createTime") %></p>
    


     

     

     

    Meet so Meet. C plusplus I-PLUS....
  • 相关阅读:
    javascript小记
    好看的echart的词云效果(wordCloud)
    工作中经常用到的git的简单操作记录
    积累就是提升之浅谈分时函数
    有意思的面试小试题
    分享张鑫旭大神的,纯css打字小技巧,我顺便收藏一下
    模仿也是提高,纯css小技巧实现头部进度条
    推荐好用的css调试工具,两个
    There appears to be trouble with your network connection. Retrying
    Enter passphrase for key ‘/root/.ssh/id_rsa’ : git push 重复输入密码的问题
  • 原文地址:https://www.cnblogs.com/iplus/p/4490457.html
Copyright © 2011-2022 走看看