纯php打造的tab选项卡效果代码(不用js)


Posted in PHP onDecember 29, 2010

1.根据get判断,获取get生成css

<style type="text/css"> 
<?php 
if(!isset($_GET['city_id'])) 
{ 
$city_id = 12; 
} 
else 
{ 
$city_id = $_GET['city_id']; 
} 
echo '.a'.$city_id.' 
{ 
color:red; 
} 
'; 
for($i=12;$i<=16;$i++) 
{ 
if($i != $city_id) 
{ 
if ($i != 12 ) 
{ 
echo '.list'.$i.'{ 
background-image:url("image/style/bg.gif"); 
}'; 
} 
else 
{ 
echo '.list'.$i.' 
{ 
background-image:url("image/style/left_bg.gif"); 
} 
'; 
} 
} 
else 
{ 
if($city_id != 12) 
{ 
echo '.list'.$city_id.' 
{ 
background-image:url("image/style/on.gif"); 
} 
'; 
}else 
{ 
echo '.list'.$city_id.'{ 
background-image:url("image/style/recuit_title.gif"); 
}'; 
} 
} 
} 
?> 
</style>

2.点击的时候,就可以打开链接
<div class="recuit_title" > 
<ul id="recuit_li"> 
<li class="list12"><a class="a12" href="test.php?city_id=12">北京</a></li> 
<?php 
include_once ("config/db.inc.php"); 
$recuit_city_select = "select * from cdb_plugins_city where city_id in(13,14,15,16)"; 
$recuit_city_query = mysql_query ( $recuit_city_select ); 
while ( $recuit_city_row = mysql_fetch_assoc ( $recuit_city_query ) ) { 
$cid = $recuit_city_row['city_id']; 
echo '<li class="list'.$recuit_city_row['city_id'].'" ><a class="a'.$recuit_city_row['city_id'].'" href="test.php?city_id=' . $recuit_city_row ['city_id'] . '">' . $recuit_city_row ['city_name'] . '</a></li>'; 
} 
?> 
</ul> 
<span class="more_recuit_info"> 
<a href="../job.php?action=recuit_list&cid=12" onClick="parent.showWindow('recuit_list',this.href);return false;">更多招募信息</a> 
</span> 
</div> 
<div class="recuit_content"> 
<table width="100%"> 
<?php 
if(!$_GET['city_id']) 
{ $recuit_content_select = "select * from cdb_plugins_recuit where city_id= 12 limit 0,8"; 
$recuit_content_query = mysql_query($recuit_content_select); 
while($recuit_content_row = mysql_fetch_assoc($recuit_content_query)) 
{ 
echo '<tr height="25"> 
<td> 
<a onclick="parent.showWindow('.'\'recuit_info\','.'this.href'.');return false;"'.'" href="../job.php?action=recuit_info&recuit_id='.$recuit_content_row['recuit_id'].'">'.$recuit_content_row['recuit_name'].'</a> 
</td> 
<td width="80" align="right" style="color:#0080ff;font-size:12px;"> 
'.$recuit_content_row['username'].'   
</td> 
</tr>'; 
} 
} 
else 
{ 
$recuit_content_select = "select * from cdb_plugins_recuit where city_id={$_GET['city_id']} limit 0,10"; 
$recuit_content_query = mysql_query($recuit_content_select); 
while($recuit_content_row = mysql_fetch_assoc($recuit_content_query)) 
{ 
echo '<tr> 
<td><a onclick="parent.showWindow('.'\'recuit_info\','.'this.href'.');return false;"'.'" href="../job.php?action=recuit_info&recuit_id='.$recuit_content_row['recuit_id'].'">'.$recuit_content_row['recuit_name'].'</a></td> 
<td width="80" align="right" style="color:#0080ff;font-size:12px;">'.$recuit_content_row['username'].'  </td> 
</tr>'; 
} 
} 
?> 
</table> 
</div> 
<div class="recuit_footer"> 
<?php 
include_once ("../include/common.inc.php"); 
$recuit_query = mysql_query("select * from cdb_plugins_recuit_userinfo where uid=$discuz_uid"); 
$recuit_rows = mysql_fetch_assoc($recuit_query); 
if($recuit_rows['uid'] == '') 
{ 
echo '<a href="../job.php?action=recuit" onclick="parent.showWindow('.'\'recuit\''.',this.href);return false;"><img src="image/style/recuit_frm_input.gif" border="0" /></a>  '; 
} 
else 
{ 
echo '<a href="../job.php?action=edit_recuit" onclick="parent.showWindow('.'\'edit_recuit\''.',this.href);return false;"><img src="image/style/edit_recuit.gif" border="0"/><a>  '; 
} 
?> 
</div>
PHP 相关文章推荐
实现分十页分向前十页向后十页的处理
Oct 09 PHP
一个php作的文本留言本的例子(六)
Oct 09 PHP
用php实现的下载css文件中的图片的代码
Feb 08 PHP
ThinkPHP CURD方法之table方法详解
Jun 18 PHP
php批量删除数据库下指定前缀的表以prefix_为例
Aug 24 PHP
PHP多文件上传类实例
Mar 07 PHP
如何使用PHP Embed SAPI实现Opcodes查看器
Nov 10 PHP
WordPress中调试缩略图的相关PHP函数使用解析
Jan 07 PHP
Yii2.0 Basic代码中路由链接被转义的处理方法
Sep 21 PHP
老生常谈PHP面向对象之标识映射
Jun 21 PHP
PHP排序算法之简单选择排序(Simple Selection Sort)实例分析
Apr 20 PHP
thinkphp整合系列之极验滑动验证码geetest功能
Jun 18 PHP
PHP的autoload自动加载机制使用说明
Dec 28 #PHP
php的ajax框架xajax入门与试用介绍
Dec 19 #PHP
几款免费开源的不用数据库的php的cms
Dec 19 #PHP
PHP操作XML作为数据库的类
Dec 19 #PHP
php中DOMDocument简单用法示例代码(XML创建、添加、删除、修改)
Dec 19 #PHP
PHP与MySQL开发的8个技巧小结
Dec 17 #PHP
hessian 在PHP中的使用介绍
Dec 13 #PHP
You might like
解析ajax事件的调用顺序
2013/06/17 PHP
[原创]PHP global全局变量经典应用与注意事项分析【附$GLOBALS用法对比】
2019/07/12 PHP
JS对URL字符串进行编码/解码分析
2008/10/25 Javascript
jquery实现简单的拖拽效果实例兼容所有主流浏览器(优化篇)
2013/06/28 Javascript
JS测试显示屏分辨率以及屏幕尺寸的方法
2013/11/22 Javascript
JS中的数组的sort方法使用示例
2014/01/22 Javascript
用nodejs实现PHP的print_r函数代码
2014/03/14 NodeJs
Javascript中replace()小结
2015/09/30 Javascript
Javascript基础回顾之(三) js面向对象
2017/01/31 Javascript
微信小程序 request接口的封装实例代码
2017/04/26 Javascript
Javascript实现跨域后台设置拦截的方法详解
2017/08/04 Javascript
jQuery实现的表格前端排序功能示例
2017/09/18 jQuery
jQuery中each和js中forEach的区别分析
2019/02/27 jQuery
微信小程序点击列表跳转到对应详情页过程解析
2019/09/26 Javascript
详解node和ES6的模块导出与导入
2020/02/19 Javascript
OpenLayers加载缩放控件使用方法详解
2020/09/25 Javascript
通过实例了解Render Props回调地狱解决方案
2020/11/04 Javascript
Python调用C语言的方法【基于ctypes模块】
2018/01/22 Python
浅谈Python中的私有变量
2018/02/28 Python
Django框架HttpResponse对象用法实例分析
2019/11/01 Python
TensorFlow tf.nn.conv2d实现卷积的方式
2020/01/03 Python
python中random模块详解
2021/03/01 Python
夏威夷咖啡公司:Hawaii Coffee Company
2019/09/19 全球购物
本科生个人求职自荐信
2013/09/26 职场文书
应届大学生自荐信
2013/12/05 职场文书
项目资料员岗位职责
2013/12/10 职场文书
舞蹈毕业生的自我评价
2014/03/05 职场文书
战友聚会主持词
2014/04/02 职场文书
2014年班主任自我评价范文
2014/04/23 职场文书
12.4全国法制宣传日活动总结
2014/11/01 职场文书
2016元旦晚会主持词开场白和结束语
2015/12/04 职场文书
CSS3新特性详解(五):多列columns column-count和flex布局
2021/04/30 HTML / CSS
pytorch交叉熵损失函数的weight参数的使用
2021/05/24 Python
使用Pytorch实现two-head(多输出)模型的操作
2021/05/28 Python
python 利用PyAutoGUI快速构建自动化操作脚本
2021/05/31 Python
MySQL高级进阶sql语句总结大全
2022/03/16 MySQL