HTML表未使用CSS更新

时间:2018-05-24 01:43:48

标签: javascript jquery html css html-table

我正在尝试创建一个具有Bootstrap表悬停功能的表以及表条带功能。但是,CSS似乎没有正确应用。 <?php Class Instagram { public $username; public $password; private $guid; private $my_uid; private $userAgent = 'Instagram 6.21.2 Android (19/4.4.2; 480dpi; 1152x1920; Meizu; MX4; mx4; mt6595; en_US)'; private $instaSignature ='25eace5393646842f0d0c3fb2ac7d3cfa15c052436ee86b5406a8433f54d24a5'; private $instagramUrl = 'https://i.instagram.com/api/v1/'; public function Login($username, $password) { $this->username = $username; $this->password = $password; $this->guid = $this->GenerateGuid(); $device_id = "android-" . $this->guid; $data = '{"device_id":"'.$device_id.'","guid":"'.$this->guid.'","username":"'. $this->username.'","password":"'.$this->password.'","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}'; $sig = $this->GenerateSignature($data); $data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=6'; $myid = $this->Request('accounts/login/', true, $data, false); $decode = json_decode($myid[1], true); $this->my_uid = $decode['logged_in_user']['pk']; print_r($this->my_uid); return $myid; } public function PostFollow($user_id) { $device_id = "android-".$this->guid; $data = '{"device_id":"'.$device_id.'","guid":"'. $this->guid .'","uid":"'.$this->my_uid.'","module_name":"feed_timeline","user_id":"'.$user_id.'","source_type":"5","filter_type":"0","extra":"{}","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}'; $sig = $this->GenerateSignature($data); $new_data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=6'; return $this->Request('friendships/create/'.$user_id.'/', true, $new_data, true); } public function PostUnFollow($user_id) { $device_id = "android-".$this->guid; $data = '{"device_id":"'.$device_id.'","guid":"'. $this->guid .'","uid":"'.$this->my_uid.'","module_name":"feed_timeline","user_id":"'.$user_id.'","source_type":"5","filter_type":"0","extra":"{}","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}'; $sig = $this->GenerateSignature($data); $new_data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=6'; return $this->Request('friendships/create/'.$user_id.'/', false, $new_data, true); } } ?> 样式正在应用,但没有行。另外,我知道return $this->Request('friendships/create/'.$user_id.'/', false, $new_data, true)行应该更清楚,但这不是我目前关注的问题。

这是目前的表格:

JavaScript:

th

CSS:

toAppend

HTML:

 function fortniteSearch(data) {
  // data to retrieve data / construct table
  const tableCells = [
  {category: "lifeTimeStats", stats: [8, 9, 10, 11, 7, 2, 4, 5]},
  {category: "stats", subcategory: "p2", stats: ["top1", "winRatio", "kills", "kd", "kpg", "matches", "top10", "top25"]},
  {category: "stats", subcategory: "p10", stats: ["top1", "winRatio", "kills", "kd", "kpg", "matches", "top5", "top12"]},
  {category: "stats", subcategory: "p9", stats: ["top1", "winRatio", "kills", "kd", "kpg", "matches", "top3", "top6"]}];

  // cell labels and flag
  const gameModes = ["OVERALL:", "SOLO:", "DUO:", "SQUADS:"];

  // check for errors
  if(data.error !== undefined)
    alert("Player not found!");

  else {
    // set player name and image
    $("#playerName").val(data.IGN);
    $("#playerIcon").attr("src", "/images/avatar_fortnite.png");
    // show stats
    $("#statDisplay").fadeIn(500);
    // clear pre-existing table
    $("#statTable").empty();
    // iterate through the table
    for(let i = 0; i < tableCells.length; i++) {
      // set header row
      $("#statTable").append('<thead> <tr> <th align = "center" colspan = 8> <b> <u>' + gameModes[i] + "</u> </b> </th> </tr> </thead> <tbody> <tr>");
      // intialize stats
      let toAppend;
      // iterate through stats
      for(let j = 0; j < tableCells[i].stats.length; j++) {
        // if there is no sub-category (use different html)
        if(tableCells[i].subcategory === undefined)
          toAppend = ("<td> <b>" + data[tableCells[i].category][tableCells[i].stats[j]].key + ":</b>" + "<br>" + data[tableCells[i].category][tableCells[i].stats[j]].value + "</td>");
        else
          toAppend = ("<td> <b>" + data[tableCells[i].category][tableCells[i].subcategory][tableCells[i].stats[j]].label + ":</b>" + "<br>" + data[tableCells[i].category][tableCells[i].subcategory][tableCells[i].stats[j]].value + "</td>");
        // add html
        $(".statTable").append(toAppend);
      }
      // close table row
      $(".statTable").append("</tr> </tbody>");
    }
    // hide game window
    $("#gameSelect").css("display", "none");
  }
}

0 个答案:

没有答案