- 精品下载 | 实用查询 | 词典查询 | 桌面壁纸 | 网址 | 笑话 | FLASH频道 | 天气文章资讯 | 站长工具 | 证件办理 | 闪字生成 | 广告代码 | 在线手册 | 有问必答
您现在的位置: 蓝派网 >> 文章中心 >> 网络编程 >> ASP >> 正文
站内文章搜索:           

用ASP程序模拟实现First-child的功能

作者:佚名    文章来源:网络转载    更新时间 :2007-11-26 0:58:33

first-child用来设置对象(Selector1)的第一个子对象(Selector2)的样式表属性。比如一个列表第一行的样式可以和其他行有所不同,但目前IE尚不支持此伪类。下面给出用ASP模拟实现的方法.

今看到经典里在讨论这个问题 ,Realazy的做法是采用了javascript,zbm2001z的做法是用了expression,我想如果这个列表是从数据库读出 来的话,用程序写可能更容易。我不是什么程序员,只会一点最简单的asp,如写的不好, 还请多多指导谅解!

asp代码

以下是引用片段:
  '数据库连接代码
  response.write "<ul class='fgList'>"
  rs.movefirst 
  response.write "<li class='firstchild'><a title='' href='#'>"&rs("列表标题")&"</a></li>"
  rs.movenext
  do while not (rs.eof or err)
  response.write "<li><a title='' href='#'>"&rs("列表标题")&"</a></li>"
  rs.moveNext
  loop
  response.write "</ul>"
  response.write "<hr />"

CSS Code

以下是引用片段:
ul.fgList{
    list-style: none;    
}
ul.fgList a{
    color: #333333;
    background: url(/img/arrow_l2.gif) no-repeat 0 50%;
    padding-left: 1.5em;
    line-height: 2em;
    text-decoration: none;
}
ul.fgList a:hover{
    color: #999999;
    text-decoration: underline;
    background: inherit;
}
ul.fgList li.firstchild a{
    color: #C00;
    background: url(/img/arrow_l2_over.gif) no-repeat 0 50%;
}
h3{
    font-size: 120%;
    padding: 2em 1em .3em .3em;
}


发表评论】【打印此文】【关闭窗口】【点击数:
★好玩的休闲小游戏★
网友评论:
数据载入中,请稍后……