手头有一个项目,核心代码是加密的,解密也没有办法,现在需要在一个特定的页面增加一个搜索功能,用关键字搜索页面的信息。
页面代码如下:
<body id="cate12">
<div class="body">
<!--幻灯片管理-->
<div style="-webkit-transform:translate3d(0,0,0); ">
<div id="banner_box" class="box_swipe">
<ul>
{loop $flashlist $row}
<li>
{if $row['type']=='link'}<a href="{$row['param']}">{/if}
{if $row['type']=='tel'}<a href="tel:{$row['param']}">{/if}
{if $row['type']=='map'}<a href="http://api.map.baidu.com/er?location={$row['param']}&title={php echo urlencode($row['title'])}&content={$row['description']}&output=html&src=weiba|weiweb">{/if}
{if $row['type']=='article'}
{php $param=explode('##',$row['param'])}
<a href="{php echo $this->createMobileUrl('fans', array('id' => $param[1]));}">{/if}
<img src="{$row['picurl']}" alt="{$row['title']}" style="width:100%;" /></a>
</li>
{/loop}
</ul>
<ol>
{loop $flashlist $key $row}
{if $key==0}
<li class="on"></li>
{else}
<li></li>
{/if}
{/loop}
</ol>
</div>
</div>
<script>
$(function(){
new Swipe(document.getElementById('banner_box'), {
speed:500,
auto:3000,
callback: function(){
var lis = $(this.element).next("ol").children();
lis.removeClass("on").eq(this.index).addClass("on");
}
});
});
</script>
<!--
添加一个搜索的功能
-->
<div class="input-group">
<input type="text" class="form-control input-lg" name="keyword" value="{$_GPC['keyword']}" placeholder="请输入{if $_GPC['isnew']==1}新品推荐{/if}{if $_GPC['ishot']==1}热卖商品{/if}{if $_GPC['isdiscount']==1}折扣商品{/if}{if $_GPC['istime']==1}限时卖{/if}关键字">
<span class="input-group-btn">
<button class="btn btn-danger btn-lg" type="submit">搜索</button>
</span>
</div>
<!--用户分类管理-->
<div id="insert1"></div>
{loop $classlist $key $row}
<div class="Category">
<div class="cname">
{$row['classname']}
</div>
<div class="clist clist{$key} swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide swiper-slide-visible swiper-slide-active">
<ul>
{loop $row['shoplist'] $shop}
<li>
<a href="{php echo ($this->createMobileUrl('story', array('id' => $shop['id'])));}">
<div>
<img src="{if empty($shop['logo'])}{$shop['picurl']}{else}{$shop['logo']}{/if}" />
</div>
<span>{$shop['shopname']}</span>
</a>
</li>
{/loop}
</ul>
</div>
</div>
<div class="cpager">
<span class="swiper-pagination-switch swiper-visible-switch swiper-active-switch"></span>
<span class="swiper-pagination-switch"></span>
</div>
<script>
$(function() {
new Swiper('.clist{$key}', {
pagination: '.clist{$key} .cpager'
});
});
</script>
</div>
</div>
{/loop}
</div><script>
var count = document.getElementById("thelist").getElementsByTagName("img").length;
for (i = 0; i < count; i++) {
document.getElementById("thelist").getElementsByTagName("img").item(i).style.cssText = " width:" + document.body.clientWidth + "px";
}
document.getElementById("scroller").style.cssText = " width:" + document.body.clientWidth * count + "px"; setInterval(function() {
myScroll.scrollToPage('next', 0, 400, count);
},
3500); window.onresize = function() {
for (i = 0; i < count; i++) {
document.getElementById("thelist").getElementsByTagName("img").item(i).style.cssText = " width:" + document.body.clientWidth + "px"; }
document.getElementById("scroller").style.cssText = " width:" + document.body.clientWidth * count + "px";
}
</script>
<footer style="overflow:visible;">
<div class="weimob-copyright" style="padding-bottom:50px;">
{if empty($footer_off)}<div id="footer">©{if empty($_W['account']['name'])}微八方团队{else}{$_W['account']['name']}{/if}</div>{/if}
</div>
</footer>
</body>
在上述红字部分增加一个搜索功能,有大神可以解决啊,私聊也可以,其他的都好说,老板急用,有会的大神私聊我,,,合作愉快!!!!!!!!!!!
页面代码如下:
<body id="cate12">
<div class="body">
<!--幻灯片管理-->
<div style="-webkit-transform:translate3d(0,0,0); ">
<div id="banner_box" class="box_swipe">
<ul>
{loop $flashlist $row}
<li>
{if $row['type']=='link'}<a href="{$row['param']}">{/if}
{if $row['type']=='tel'}<a href="tel:{$row['param']}">{/if}
{if $row['type']=='map'}<a href="http://api.map.baidu.com/er?location={$row['param']}&title={php echo urlencode($row['title'])}&content={$row['description']}&output=html&src=weiba|weiweb">{/if}
{if $row['type']=='article'}
{php $param=explode('##',$row['param'])}
<a href="{php echo $this->createMobileUrl('fans', array('id' => $param[1]));}">{/if}
<img src="{$row['picurl']}" alt="{$row['title']}" style="width:100%;" /></a>
</li>
{/loop}
</ul>
<ol>
{loop $flashlist $key $row}
{if $key==0}
<li class="on"></li>
{else}
<li></li>
{/if}
{/loop}
</ol>
</div>
</div>
<script>
$(function(){
new Swipe(document.getElementById('banner_box'), {
speed:500,
auto:3000,
callback: function(){
var lis = $(this.element).next("ol").children();
lis.removeClass("on").eq(this.index).addClass("on");
}
});
});
</script>
<!--
添加一个搜索的功能
-->
<div class="input-group">
<input type="text" class="form-control input-lg" name="keyword" value="{$_GPC['keyword']}" placeholder="请输入{if $_GPC['isnew']==1}新品推荐{/if}{if $_GPC['ishot']==1}热卖商品{/if}{if $_GPC['isdiscount']==1}折扣商品{/if}{if $_GPC['istime']==1}限时卖{/if}关键字">
<span class="input-group-btn">
<button class="btn btn-danger btn-lg" type="submit">搜索</button>
</span>
</div>
<!--用户分类管理-->
<div id="insert1"></div>
{loop $classlist $key $row}
<div class="Category">
<div class="cname">
{$row['classname']}
</div>
<div class="clist clist{$key} swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide swiper-slide-visible swiper-slide-active">
<ul>
{loop $row['shoplist'] $shop}
<li>
<a href="{php echo ($this->createMobileUrl('story', array('id' => $shop['id'])));}">
<div>
<img src="{if empty($shop['logo'])}{$shop['picurl']}{else}{$shop['logo']}{/if}" />
</div>
<span>{$shop['shopname']}</span>
</a>
</li>
{/loop}
</ul>
</div>
</div>
<div class="cpager">
<span class="swiper-pagination-switch swiper-visible-switch swiper-active-switch"></span>
<span class="swiper-pagination-switch"></span>
</div>
<script>
$(function() {
new Swiper('.clist{$key}', {
pagination: '.clist{$key} .cpager'
});
});
</script>
</div>
</div>
{/loop}
</div><script>
var count = document.getElementById("thelist").getElementsByTagName("img").length;
for (i = 0; i < count; i++) {
document.getElementById("thelist").getElementsByTagName("img").item(i).style.cssText = " width:" + document.body.clientWidth + "px";
}
document.getElementById("scroller").style.cssText = " width:" + document.body.clientWidth * count + "px"; setInterval(function() {
myScroll.scrollToPage('next', 0, 400, count);
},
3500); window.onresize = function() {
for (i = 0; i < count; i++) {
document.getElementById("thelist").getElementsByTagName("img").item(i).style.cssText = " width:" + document.body.clientWidth + "px"; }
document.getElementById("scroller").style.cssText = " width:" + document.body.clientWidth * count + "px";
}
</script>
<footer style="overflow:visible;">
<div class="weimob-copyright" style="padding-bottom:50px;">
{if empty($footer_off)}<div id="footer">©{if empty($_W['account']['name'])}微八方团队{else}{$_W['account']['name']}{/if}</div>{/if}
</div>
</footer>
</body>
在上述红字部分增加一个搜索功能,有大神可以解决啊,私聊也可以,其他的都好说,老板急用,有会的大神私聊我,,,合作愉快!!!!!!!!!!!
应该就是像chrome的页内查找一样
自动定位到页面中的关键字位置并高亮/变色 显示
是这样吧
//搜索设置
<script language="javascript">
function check_submit(){
if(form1.tb_send_subject_content.value==""){
alert("查询条件不允许为空!");form1.tb_send_subject_content.focus();return false;
}
form1.submit();
}//codego.net/tags/10/1/
</script>
<table width="140" border="1">
<form name="form1" method="post" action="sou_suo_ok.php?class=搜索引擎&&content=<?php echo $_GET[content];?>">
<tr>
<td>查询条件:名称-作者-时间</td>
</tr>
<tr>
<td><input name="tb_send_subject_content" type="text" size="25"/></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="搜索引擎" onclick="return check_submit();" />
</td>
</tr>
</form>
</table>
//搜索页面查询数据库信息显示
<?php
//获取帖子的类型 //获取帖子的类别
//从发布的帖子中查询
$query_6=mysql_query("select * from tb_photo where picname like '%$tb_send_subject_content%' or upname like '%$tb_send_subject_content%' or uptime like '%$tb_send_subject_content%'");
//从回复的帖子中搜索
//统计查询的结果
if(mysql_num_rows($query_6)){
if($page){ //定义分页的变量
$page_size=6;
$number=0; //定义每页显示的数量
$query="select count(*) as total from tb_photo where picname like '%$tb_send_subject_content%' or upname like '%$tb_send_subject_content%'or uptime like '%$tb_send_subject_content%'";
$result=mysql_query($query);
$message_count=mysql_result($result,0,"total");
$page_count=ceil($message_count/$page_size);
$offset=($page-1)*$page_size;
$query_2=mysql_query("select * from tb_photo where picname like '%$tb_send_subject_content%' or upname like '%$tb_send_subject_content%' or uptime like '%$tb_send_subject_content%' limit $offset, $page_size");
while($myrow_2=mysql_fetch_array($query_2)){
if(($number % 4) == 0){
?>
<tr>
<?php
}
?>
<td colspan="2" align="center">
<table width="260" height="120" border="1">
<tr>
<td width="117" rowspan="6"><img src="<?php echo $myrow_2[picpath];?>" width="140" height="120" /></td>
<td width="140" style="font-size:12px"><span class="STYLE2">图片名称</span></td>
</tr>
<tr>
<td width="120" height="20" style="font-size:12px"><a href="send_forum_content.php?up_id=<?php echo $myrow_2[up_id];?>" target="_blank"><?php echo $myrow_2[picname];?></a> </td>
</tr>
<tr>
<td width="120" height="20" style="font-size:12px">创建人</td>
</tr>
<tr>
<td width="120" height="20" style="font-size:12px"><?php echo $myrow_2[upname];?></td>
</tr>
<tr>
<td width="120" height="20" style="font_size:12px">创建时间</td>
</tr>
<tr>
<td width="120" height="20" style="font-size:12px"><?php echo $myrow_2[uptime];?></td>
</tr>
</table>
<?php
$number++;
}
?>
</tr>
</td>
<?php
}
?>//翻页功能(略)