转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 站长学院 >> 网页制作 >> 正文
CSS+DIV实现Yahoo搜索框的制作         ★★★★

CSS+DIV实现Yahoo搜索框的制作

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1563 更新时间:2009/4/23 13:49:55

  本文及代码由 renx 原创,版权所有,随便使用,哪位大大看得起在下,有用到的话,我很荣幸您能告诉我.
开始
为了做这个yahoo搜索框,我分了三步:
1. 先做搜索分类的按钮,点击后会和其他按钮看上去比较不一样,这个是挺简单的

<!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>
<title>search_bar</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
body,html {
    font-size:12px;
}
.none {display: none;}
.block {display: block;}
.s_c {width:800px;text-align: center;}
.s_c ul{clear:both;margin:0;}
.s_c li{list-style:none;float:left;position: relative;width: 70px;}
.c_0 {padding:0px 10px 0px 10px;line-height:22px}
.c_0 a{color:#666;text-decoration: none;}
.c_1 {padding:4px 0;width: 70px;
    background:#0075eb;border:1px solid #054576;border-bottom-width:0;text-decoration: none;}
.c_1 a{color:#FFF;font-weight:bold;text-decoration: none;}
.c_2 {padding:4px 0;width: 70px;background:#a10303;border:1px solid #662626;border-bottom-width:0;}
    position: absolute;bottom: -7px;left: 0;}
.c_3 {padding:4px 0;width: 70px;background:#B01FAA;border:1px solid #760473;border-bottom-width:0;}
.white a {color:#FFF;font-weight:bold;text-decoration: none;}
</style>
<script language="javascript">
function aa(s_id){
    for(i=1;i<4;i++){
        if(i==s_id){
            document.getElementById("m"+i).className="c_"+i+" white";
        }
        else {
            document.getElementById("m"+i).className="c_0";
        }
    }
}
</script>
</head>
<body>
<div class="s_c"><ul>
    <li><div id="m1" class="c_1"><a href="###" onClick="aa(’1’)">分类第一</a></div></li>
    <li><div id="m2" class="c_0"><a href="###" onClick="aa(’2’)">分类第二</a></div></li>
    <li><div id="m3" class="c_0"><a href="###" onClick="aa(’3’)">分类第三</a></div></li>
    </ul>
</div>
</body>
</html>

当然这还不够,接下来实现第二步效果.

2.加个搜索输入框,而且要能换颜色的 

<!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>
<title>search_bar</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
body,html {
    font-size:12px;
}
.none {display: none;}
.block {display: block;}
.s_c {width:800px;text-align: center;}
.s_c ul{clear:both;margin:0;}
.s_c li{list-style:none;float:left;position: relative;width: 70px;}
.s_b {border:1px solid #666;}
.s_b span{padding:20px 20px;vertical-align:middle;}
.s_b input{margin:8px 8px;}
.search_0 {background:#fff;}
.search_1 {background:#d2e4fc;}
.search_2 {background:#fcd2d2;}
.search_3 {background:#F9D3FA;}
.search_4 {background:#defbfb;}
.search_5 {background:#fce8d2;}
.search_6 {background:#FCEBB9;}
.c_0 {padding:0px 10px 0px 10px;line-height:22px}
.c_0 a{color:#666;text-decoration: none;}
.c_1 {padding:4px 0;width: 70px;
    background:#0075eb;border:1px solid #054576;border-bottom-width:0;text-decoration: none;}
.c_1 a{color:#FFF;font-weight:bold;text-decoration: none;}
.c_2 {padding:4px 0;width: 70px;background:#a10303;border:1px solid #662626;border-bottom-width:0;}
    position: absolute;bottom: -7px;left: 0;}
.c_3 {padding:4px 0;width: 70px;background:#B01FAA;border:1px solid #760473;border-bottom-width:0;}
.white a {color:#FFF;font-weight:bold;text-decoration: none;}
</style>
<script language="javascript">
function aa(s_id){
    for(i=1;i<4;i++){
        if(i==s_id){
            document.getElementById("s"+i).className="block be";
            document.getElementById("m"+i).className="c_"+i+" white";
            document.getElementById("uid_"+i).focus();
        }
        else {
            document.getElementById("s"+i).className="none";
            document.getElementById("m"+i).className="c_0";
        }
    }
}
</script>
</head>
<body>
<div class="s_c"><ul>
    <li><div id="m1" class="c_1"><a href="###" onClick="aa(’1’)">分类第一</a></div></li>
    <li><div id="m2" class="c_0"><a href="###" onClick="aa(’2’)">分类第二</a></div></li>
    <li><div id="m3" class="c_0"><a href="###" onClick="aa(’3’)">分类第三</a></div></li>
    </ul>
</div>
<div class="s_b">
    <div class="block" id="s1"><div class="search_1"><span>Search the Web:</span><input name="uid" id="uid_1" /><span>按钮</span></div></div>
    <div class="none" id="s2"><div class="search_2"><span>Search the Web:</span><input name="uid" id="uid_2" /><span>按钮</span></div></div>
    <div class="none" id="s3"><div class="search_3"><span>Search the Web:</span><input name="uid" id="uid_3" /><span>按钮</span></div></div>
</div>
</body>
</html>

  3. 现在加个箭头,做个外框,当然也要不同颜色的

<!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>
<title>search_bar</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
body,html {
    font-size:12px;
}
.none {display: none;}
.block {display: block;}
.s_c {width:800px;text-align: center;}
.s_c ul{clear:both;margin:0;}
.s_c li{list-style:none;float:left;position: relative;width: 70px;}
.s_b {border:1px solid #666;}
.s_b span{padding:20px 20px;vertical-align:middle;}
.s_b input{margin:8px 8px;}
.search_0 {background:#fff;}
.search_1 {background:#d2e4fc;}
.search_2 {background:#fcd2d2;}
.search_3 {background:#F9D3FA;}
.search_4 {background:#defbfb;}
.search_5 {background:#fce8d2;}
.search_6 {background:#FCEBB9;}
.c_0 {padding:0px 10px 0px 10px;line-height:22px}
.c_0 a{color:#666;text-decoration: none;}
.c_1 {padding:4px 0;width: 70px;
    background:#0075eb;border:1px solid #054576;border-bottom-width:0;text-decoration: none;}
.c_1 a{color:#FFF;font-weight:bold;text-decoration: none;}
.c_1 b{width:100%;height:11px;background:url("picture/sc1.gif") no-repeat 50% bottom;position: absolute;bottom: -7px;left: 0;}
.c_2 {padding:4px 0;width: 70px;background:#a10303;border:1px solid #662626;border-bottom-width:0;}
.c_2 b{width:100%;height:11px;background:url("picture/sc2.gif") no-repeat 50% bottom;
    position: absolute;bottom: -7px;left: 0;}
.c_3 {padding:4px 0;width: 70px;background:#B01FAA;border:1px solid #760473;border-bottom-width:0;}
.c_3 b{width:100%;height:11px;background:url("picture/sc3.gif") no-repeat 50% bottom;position: absolute

[1] [2]  下一页


[聊天工具]仿效Google?Yahoo决定在邮箱内嵌入IM  [聊天工具]MSN + Yahoo Messenger整合很快完工_工具软件
[聊天工具]MSN如何与Yahoo互通?快登记参加MSN8测试  [聊天工具]BQYAHOO 升级YAHOO邮箱功能__天极Yesky
[聊天工具]Yahoo Messenger 注册指南__天极Yesky  [常用软件]OCLC和Yahoo!合作打造双重商标工具栏
[常用软件]一招搞定Gmail、Yahoo、Hotmail  [常用软件]用OutLook登陆Yahoo的1G邮箱
[网页制作]像table一样布局div  [网页制作]用GoLive实现CSS+DIV之二
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Web开发  · 网页制作
    · 平面设计  · 网站运营
    · 网站推广  · 搜索优化
    · 建站心得  · 站长故事
    · 互联动态
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台