Javascript:如何在单击行表上添加颜色并将其刷新页面,颜色为';不变

Javascript:如何在单击行表上添加颜色并将其刷新页面,颜色为';不变,javascript,php,html,Javascript,Php,Html,我想在单击行表时添加颜色。并且刷新页面后颜色不变,点击表格后仍然得到颜色。颜色表示已单击表行。单击“行表”将打开模式淡入淡出引导 为什么当数据库中的数据由于大量资金而褪色时,页面在打开时会感觉沉重 JAVASCRIPT脚本: <script type="text/javascript"> $(document).ready(function() { $("#tabel1, #tabel2").dataTable({ "sDom": "&

我想在单击行表时添加颜色。并且刷新页面后颜色不变,点击表格后仍然得到颜色。颜色表示已单击表行。单击“行表”将打开模式淡入淡出引导

为什么当数据库中的数据由于大量资金而褪色时,页面在打开时会感觉沉重

JAVASCRIPT脚本:

    <script type="text/javascript">
    $(document).ready(function() {
    $("#tabel1, #tabel2").dataTable({
            "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span12'i><'span12 center'p>>",
            "sPaginationType": "bootstrap",
            "order": [[0, "desc"]]
    });
    $(".clickable-row").each(function(i,tr){
        var bla = $(this).find('td:eq(3)').text();
          if(localStorage.getItem(bla)=='1') {
            $(this).addClass("visited");
          }
    });
    });
    </script>

$(文档).ready(函数(){
$(“#表1,#表2”).dataTable({
“sDom”:“t”,
“sPaginationType”:“引导程序”,
“订单”:[[0,“描述”]]
});
$(“.clickable row”)。每个(函数(i,tr){
var bla=$(this.find('td:eq(3)').text();
if(localStorage.getItem(bla)='1'){
$(此).addClass(“已访问”);
}
});
});
表脚本:

<table id="tabel2">
      <thead>
          <tr>
              <th width="35%">Date</th>
              <th width="15%">Order</th>
              <th width="20%">Status</th>
              <th width="15%">INVOICE</th>
              <th width="15%">No. Table</th>                                            
          </tr>
      </thead>   
      <tbody>
            <tr class="clickable-row">
                <td class="center" data-toggle="modal" data-target="#myModal$invoice"><h4>$ymd</h4></td>
                <td class="center" data-toggle="modal" data-target="#myModal$invoice">$name</td>
                <td class="center" data-toggle="modal" data-target="#myModal$invoice">$status</td>
                <td>
                    <a class="label label-success invoice" data-toggle="modal" data-target="#myModal$invoice">$invoice</a>
                </td>
                <td class="center" data-toggle="modal" data-target="#myModal$invoice">No. $table</td>
            </tr>                                                  
      </tbody>
</table> 
    <?php

        $sql5 = "SELECT invoice FROM order GROUP BY invoice";
        $see5 = mysql_query($sql5);                         
        while($select_result5 = mysql_fetch_array($see5))
        {
        $invoice    = $select_result5['invoice'] ;
echo"
    <div class='modal hide fade' id='myModal$invoice'>
        <div class='modal-header'>
            <button type='button' class='close' data-dismiss='modal'>×</button>
            <h3>Detail Order Invoice : $invoice</h3>
        </div>
        <div class='modal-body'>
        <style>.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
        <div class='embed-container'><iframe src='order.php?invoice=$invoice' style='border:0'></iframe></div>

        </div>
        <!-- div class='modal-footer'>
            <a href='#' class='btn' data-dismiss='modal'>Close</a>
            <a href='#' class='btn btn-primary'>Save changes</a>
        </div -->
    </div>"
    ;}
?>

日期
命令
地位
发票
不,桌子
$ymd
$name
$status
"
;}
?>

我想这会有帮助。我使用的
:target
是当你
href

#某物{
宽度:100px;
高度:100px;
背景:黑色;
颜色:白色;
}
#某物:目标{
背景:绿色;
}

由于长循环,页面很重。如何修复此问题?因为我使用了模式淡入法:(@UllasHunkai尝试此方法,但没有更改颜色:(
<div id="something"><a href="#something">click me</a></div>
<style>
  #something{
    width:100px;
    height:100px;
    background:black;
    color:white;
  }
  #something:target {
  background:green;
  }
</style>