根据网址

时间:2016-12-13 13:08:04

标签: javascript jquery codeigniter-3

如何在ID链接到该特定ID或文本的URL链接中突出显示视图中的文本?
我有50个列表,我需要突出显示特定的id或文本

我不知道我是应该用 jquery 还是用 codeigniter 3来写。

  

例如。
localhost / example / admin / home / CL00074

image
这是我要强调的图片。
如果您不明白,请告诉我。

enter image description here

检查refferal

3 个答案:

答案 0 :(得分:0)

可能性二

  1. 这是使用细分 关注link
  2. 2.这是使用路线 关注link

    添加到脚本config / route.php

    $ route [' admin / home /(:any)'] =' Controllername / functionname / $ 1';

答案 1 :(得分:0)

假设您的链接是localhost / example / admin / home#CL00074并且您的ID进入html,如下所示:

<div id="CL00074">

</div>

,您只能使用css来突出显示或设置页面的特定元素(div,h1,li或其他)的样式。 使用:target css标识符:

:taget{
    color: black;
    border: 1px solid red;
} 

答案 2 :(得分:0)

您应该使用Code Igniter的URI library,它看起来像这样:

  

$这 - &GT; URI-&GT;段(n)的

但由于这是一个jQuery问题,你可以使用哈希并以这种方式定位:

更新路由: localhost / example / admin / home#CL00074

// if hash exists, check and highlight
if (window.location.hash) {
    var hash = window.location.hash.replace('#', '');

    $('td[id='+ hash +']').addClass('selected');
}