純php打造的tab選項(xiàng)卡效果代碼(不用js)
更新時(shí)間:2010年12月29日 11:14:44 作者:
用php實(shí)現(xiàn)的tab選項(xiàng)卡效果,根據(jù)get判斷,獲取get生成css與對應(yīng)的內(nèi)容,當(dāng)然效率肯定沒有靜態(tài)的好,這里給出的思路與方法。
1.根據(jù)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.點(diǎn)擊的時(shí)候,就可以打開鏈接
<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>
復(fù)制代碼 代碼如下:
<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.點(diǎn)擊的時(shí)候,就可以打開鏈接
復(fù)制代碼 代碼如下:
<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>
您可能感興趣的文章:
- javascript實(shí)現(xiàn)tabs選項(xiàng)卡切換效果(自寫原生js)
- js實(shí)現(xiàn)tab選項(xiàng)卡函數(shù)代碼
- Vue.js組件tabs實(shí)現(xiàn)選項(xiàng)卡切換效果
- 使用vue.js寫一個(gè)tab選項(xiàng)卡效果
- js tab 選項(xiàng)卡
- 原生js實(shí)現(xiàn)tab選項(xiàng)卡切換
- 跨瀏覽器通用、可重用的選項(xiàng)卡tab切換js代碼
- 4種JavaScript實(shí)現(xiàn)簡單tab選項(xiàng)卡切換的方法
- Vue.js組件tab實(shí)現(xiàn)選項(xiàng)卡切換
- JavaScript插件Tab選項(xiàng)卡效果
相關(guān)文章
laravel框架學(xué)習(xí)筆記之組件化開發(fā)實(shí)現(xiàn)方法
這篇文章主要介紹了laravel框架學(xué)習(xí)筆記之組件化開發(fā)實(shí)現(xiàn)方法,結(jié)合實(shí)例形式分析了laravel框架組件化開發(fā)相關(guān)的實(shí)現(xiàn)步驟與操作注意事項(xiàng),需要的朋友可以參考下2020-02-02
php判斷手機(jī)瀏覽還是web瀏覽,并執(zhí)行相應(yīng)的動作簡單實(shí)例
下面小編就為大家?guī)硪黄猵hp判斷手機(jī)瀏覽還是web瀏覽,并執(zhí)行相應(yīng)的動作簡單實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給的大家做個(gè)參考。一起跟隨小編過來看看吧2016-07-07
Zend?Framework框架db類select查詢器join鏈表使用示例
這篇文章主要介紹了Zend?Framework框架的Db類select查詢器join鏈表使用示例,需要的朋友可以參考下2014-03-03
ThinkPHP框架實(shí)現(xiàn)導(dǎo)出excel數(shù)據(jù)的方法示例【基于PHPExcel】
這篇文章主要介紹了ThinkPHP框架實(shí)現(xiàn)導(dǎo)出excel數(shù)據(jù)的方法,結(jié)合實(shí)例形式分析了thinkPHP添加org擴(kuò)展基于PHPExcel進(jìn)行Excel數(shù)據(jù)的導(dǎo)出操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-05-05
Mac版PhpStorm之XAMPP整合apache服務(wù)器配置的圖文教程詳解
選擇在PhpStorm集成apache服務(wù)器,但是很多朋友不知道是如何操作的,下面小編分步驟通過圖文的形式給大家介紹Mac版PhpStorm之XAMPP整合apache服務(wù)器配置的教程,感興趣的朋友一起看看吧2016-10-10
session 加入redis的實(shí)現(xiàn)代碼
本篇文章主要介紹了session 加入redis 的實(shí)例,對session 進(jìn)行了詳細(xì)介紹,并提供了代碼實(shí)例,需要的朋友可以參考下2016-07-07
php使用array_chunk函數(shù)將一個(gè)數(shù)組分割成多個(gè)數(shù)組
這篇文章主要介紹了php使用array_chunk函數(shù)將一個(gè)數(shù)組分割成多個(gè)數(shù)組,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-12-12

