【澳门葡京】JS落成限制行驶,JS小游戏之象棋暗棋源码详解

 一、JS代码完毕

【澳门葡京】JS落成限制行驶,JS小游戏之象棋暗棋源码详解。       壹、
机高铁辆限制行驶如下图所示:

   
 澳门葡京 1

澳门葡京 ,     
 具体详细情况请访问:

     二、JS代码落成

  1 <!DOCTYPE html>
  2 <html>
  3 <head>
  4     <meta name="viewport" content="width=device-width" />
  5     <title>北京市机动车辆尾号限行实现(JS)</title>
  6     <style>
  7         .limit {
  8             font-size: 20px;
  9             width: 100%;
 10             background-color: aliceblue;
 11             border-radius: 5px;
 12             padding: 20px;
 13         }
 14         .limit span {
 15             color: red;
 16             font-weight: bold;
 17         }
 18         .limit a {
 19             font-size: 16px;
 20         }
 21     </style>
 22     <script src="~/Content/jquery-2.1.1.min.js"></script>
 23     <script type="text/javascript">
 24         $(function () {
 25             GetLimitNum();
 26         })
 27 
 28         //限行方法
 29         function GetLimitNum() {
 30             //获取当天日期
 31             var dt = new Date().format("yyyy-MM-dd");
 32             var startDate = "2012-10-08";//开始星期,周一的日期
 33             var ln1 = "1和6";
 34             var ln2 = "2和7";
 35             var ln3 = "3和8";
 36             var ln4 = "4和9";
 37             var ln5 = "5和0";
 38             var ln6 = "不限行";
 39             var ln7 = "不限行";
 40             //开始日期
 41             var startArr = startDate.split('-');
 42             var vStartDate = new Date(startArr[0], startArr[1] - 1, startArr[2]);
 43             //当前日期
 44             var todayArr = dt.split("-");
 45             var vTodayDate = new Date(todayArr[0], todayArr[1] - 1, todayArr[2]);
 46             //今天限行尾号
 47             var nTodayNum = getXHNumber(vTodayDate, vStartDate);
 48             //明天限行尾号
 49             vTodayDate.setDate(vTodayDate.getDate() + 1);
 50             var nTomorrowNum = getXHNumber(vTodayDate, vStartDate);
 51             //星期赋值
 52             var arr_week = new Array("星期六", "星期日", "星期一", "星期二", "星期三", "星期四", "星期五");
 53             var todayweek = vTodayDate.getDay();
 54             $("#todayweek").html(arr_week[todayweek]);
 55             $("#tomorrowweek").html(arr_week[(todayweek + 1) == 7 ? 0 : todayweek + 1]);
 56             //限行尾号赋值
 57             $("#todaynum").html(eval('ln' + nTodayNum));
 58             $("#tomorrownum").html(eval('ln' + nTomorrowNum));
 59         }
 60 
 61         //获取限行尾号
 62         function getXHNumber(tDate, sDate) {
 63             var nDayNum = tDate.getDay() == 0 ? 7 : tDate.getDay();
 64             if (nDayNum > 5) return nDayNum;
 65             var nDiff = (tDate - sDate) / 1000 / 3600 / 24 / 7 / 13;
 66             nDiff = Math.floor(nDiff) % 5;
 67             nDayNum = 5 - nDiff + nDayNum;
 68             if (nDayNum > 5) nDayNum -= 5;
 69             return nDayNum;
 70         }
 71 
 72         //时间格式化
 73         Date.prototype.format = function (fmt) {
 74             var o = {
 75                 "M+": this.getMonth() + 1,                    //月份
 76                 "d+": this.getDate(),                         //日
 77                 "h+": this.getHours(),                        //小时
 78                 "m+": this.getMinutes(),                      //分
 79                 "s+": this.getSeconds(),                      //秒
 80                 "q+": Math.floor((this.getMonth() + 3) / 3),  //季度
 81                 "S": this.getMilliseconds()                   //毫秒
 82             };
 83             if (/(y+)/.test(fmt)) {
 84                 fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
 85             }
 86             for (var k in o) {
 87                 if (new RegExp("(" + k + ")").test(fmt)) {
 88                     fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
 89                 }
 90             }
 91             return fmt;
 92         }
 93     </script>
 94 </head>
 95 <body>
 96     <div class="limit" id="limitLine">
 97         &nbsp;限行尾号:<br>
 98         &nbsp;限行尾号:
 99         &nbsp;&nbsp;<a href="http://www.bjjtgl.gov.cn/zhuanti/10weihao/index.html" target="_blank">详情&gt;&gt;</a>
100     </div>
101 </body>
102 </html>

 一、JS代码完毕

       1、 机轻轨辆限行如下图所示:

     澳门葡京 2

     
 具体详细情况请访问:

     贰、JS代码落成

  1 <!DOCTYPE html>
  2 <html>
  3 <head>
  4     <meta name="viewport" content="width=device-width" />
  5     <title>北京市机动车辆尾号限行实现(JS)</title>
  6     <style>
  7         .limit {
  8             font-size: 20px;
  9             width: 100%;
 10             background-color: aliceblue;
 11             border-radius: 5px;
 12             padding: 20px;
 13         }
 14         .limit span {
 15             color: red;
 16             font-weight: bold;
 17         }
 18         .limit a {
 19             font-size: 16px;
 20         }
 21     </style>
 22     <script src="~/Content/jquery-2.1.1.min.js"></script>
 23     <script type="text/javascript">
 24         $(function () {
 25             GetLimitNum();
 26         })
 27 
 28         //限行方法
 29         function GetLimitNum() {
 30             //获取当天日期
 31             var dt = new Date().format("yyyy-MM-dd");
 32             var startDate = "2012-10-08";//开始星期,周一的日期
 33             var ln1 = "1和6";
 34             var ln2 = "2和7";
 35             var ln3 = "3和8";
 36             var ln4 = "4和9";
 37             var ln5 = "5和0";
 38             var ln6 = "不限行";
 39             var ln7 = "不限行";
 40             //开始日期
 41             var startArr = startDate.split('-');
 42             var vStartDate = new Date(startArr[0], startArr[1] - 1, startArr[2]);
 43             //当前日期
 44             var todayArr = dt.split("-");
 45             var vTodayDate = new Date(todayArr[0], todayArr[1] - 1, todayArr[2]);
 46             //今天限行尾号
 47             var nTodayNum = getXHNumber(vTodayDate, vStartDate);
 48             //明天限行尾号
 49             vTodayDate.setDate(vTodayDate.getDate() + 1);
 50             var nTomorrowNum = getXHNumber(vTodayDate, vStartDate);
 51             //星期赋值
 52             var arr_week = new Array("星期六", "星期日", "星期一", "星期二", "星期三", "星期四", "星期五");
 53             var todayweek = vTodayDate.getDay();
 54             $("#todayweek").html(arr_week[todayweek]);
 55             $("#tomorrowweek").html(arr_week[(todayweek + 1) == 7 ? 0 : todayweek + 1]);
 56             //限行尾号赋值
 57             $("#todaynum").html(eval('ln' + nTodayNum));
 58             $("#tomorrownum").html(eval('ln' + nTomorrowNum));
 59         }
 60 
 61         //获取限行尾号
 62         function getXHNumber(tDate, sDate) {
 63             var nDayNum = tDate.getDay() == 0 ? 7 : tDate.getDay();
 64             if (nDayNum > 5) return nDayNum;
 65             var nDiff = (tDate - sDate) / 1000 / 3600 / 24 / 7 / 13;
 66             nDiff = Math.floor(nDiff) % 5;
 67             nDayNum = 5 - nDiff + nDayNum;
 68             if (nDayNum > 5) nDayNum -= 5;
 69             return nDayNum;
 70         }
 71 
 72         //时间格式化
 73         Date.prototype.format = function (fmt) {
 74             var o = {
 75                 "M+": this.getMonth() + 1,                    //月份
 76                 "d+": this.getDate(),                         //日
 77                 "h+": this.getHours(),                        //小时
 78                 "m+": this.getMinutes(),                      //分
 79                 "s+": this.getSeconds(),                      //秒
 80                 "q+": Math.floor((this.getMonth() + 3) / 3),  //季度
 81                 "S": this.getMilliseconds()                   //毫秒
 82             };
 83             if (/(y+)/.test(fmt)) {
 84                 fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
 85             }
 86             for (var k in o) {
 87                 if (new RegExp("(" + k + ")").test(fmt)) {
 88                     fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
 89                 }
 90             }
 91             return fmt;
 92         }
 93     </script>
 94 </head>
 95 <body>
 96     <div class="limit" id="limitLine">
 97         &nbsp;限行尾号:<br>
 98         &nbsp;限行尾号:
 99         &nbsp;&nbsp;<a href="http://www.bjjtgl.gov.cn/zhuanti/10weihao/index.html" target="_blank">详情&gt;&gt;</a>
100     </div>
101 </body>
102 </html>

正文实例讲述了JS+CSS完结表格高亮的诀要。分享给大家供大家参考。具体如下:

正文实例讲述了JS小游戏的象棋暗棋源码,分享给我们供我们参考。具体如下:

②、效果彰显

      
限制行驶代码运维结果如下图所示:

     
 澳门葡京 3

二、效果展现

       限制行驶代码运营结果如下图所示:

       澳门葡京 4

此间运用JavaScript+CSS完毕表格高亮的效率,实际上类似于隔行换色的功能,说法各异而已,只然则本效果是在鼠标移上时接触,移出结束。

娱乐运营后如下图所示:

三、示例下载

        Demo:LimitLineDemo

 

3、示例下载

        Demo:LimitLineDemo

 

运作效果如下图所示:

澳门葡京 5

澳门葡京 6

Javascript 部分:

切实代码如下:

/** chinese chess 
*  Author: fdipzone 
*  Date:  2012-06-24 
*  Ver:  1.0 
*/ 

var gameimg = ['images/a1.gif','images/a2.gif','images/a3.gif','images/a4.gif','images/a5.gif','images/a6.gif','images/a7.gif','images/b1.gif','images/b2.gif','images/b3.gif','images/b4.gif','images/b5.gif','images/b6.gif','images/b7.gif','images/bg.gif','images/bg_over.gif','images/bg_sel.gif']; 
var chess_obj = new ChessClass(); 

window.onload = function(){ 
  $('init_btn').onclick = function(){ 
    chess_obj.init(); 
  } 
  var callback = function(){ 
    chess_obj.init(); 
  } 
  img_preload(gameimg, callback); 
} 

// chess class 
function ChessClass(){ 
  this.chess = []; 
  this.boardrows = 4; 
  this.boardcols = 8; 
  this.area = 82; 
  this.player = 1;  // 1:red 2:green 
  this.selected = null;  // selected chess 
  this.chesstype = ['', 'a', 'b']; 
  this.isover = 0; 
} 

// init 
ChessClass.prototype.init = function(){ 
  this.reset_grade();  
  this.create_board(); 
  this.create_chess(); 
  this.create_event(); 
  this.player = 1; 
  this.selected = null; 
  this.isover = 0; 
  disp('init_div','hide'); 
} 

// create board 
ChessClass.prototype.create_board = function(){ 
  var board = ''; 
  for(var i=0; i<this.boardrows; i++){ 
    for(var j=0; j<this.boardcols; j++){ 
      board = board + '<div id="' + i + '_' + j + '"><img src="images/chessbg.gif" /></div>'; 
    } 
  } 
  $('board').innerHTML = board; 
  $('board').style.width = this.boardcols * (this.area + 2) + 'px'; 
  $('board').style.height = this.boardrows * (this.area + 2) + 'px'; 
} 

// create random chess 
ChessClass.prototype.create_chess = function(){ 
  // 32 chesses 
  var chesses = ['a1','b7','a2','b7','a2','b7','a3','b7','a3','b7','a4','b6','a4','b6','a5','b5', 
           'a5','b5','a6','b4','a6','b4','a7','b3','a7','b3','a7','b2','a7','b2','a7','b1']; 
  this.chess = []; 
  while(chesses.length>0){ 
    var rnd = Math.floor(Math.random()*chesses.length); 
    var tmpchess = chesses.splice(rnd, 1).toString(); 
    this.chess.push({'chess':tmpchess, 'type':tmpchess.substr(0,1), 'val':tmpchess.substr(1,1), 'status':0}); 
  } 
} 

// create event 
ChessClass.prototype.create_event = function(){ 
  var self = this; 
  var chess_area = $_tag('div', 'board'); 
  for(var i=0; i<chess_area.length; i++){ 
    chess_area[i].onmouseover = function(){ // mouseover 
      if(this.className!='onsel'){ 
        this.className = 'on'; 
      } 
    } 
    chess_area[i].onmouseout = function(){ // mouseout 
      if(this.className!='onsel'){ 
        this.className = ''; 
      } 
    } 
    chess_area[i].onclick = function(){ // onclick 
      self.action(this); 
    } 
  } 
} 

// id change index 
ChessClass.prototype.getindex = function(id){ 
  var tid = id.split('_'); 
  return parseInt(tid[0])*this.boardcols + parseInt(tid[1]); 
} 

// index change id 
ChessClass.prototype.getid = function(index){ 
  return parseInt(index/this.boardcols) + '_' + parseInt(index%this.boardcols); 
} 

// action 
ChessClass.prototype.action = function(o){ 
  if(this.isover==1){ // game over 
    return false; 
  } 

  var index = this.getindex(o.id); 

  if(this.selected == null){ // 未选过棋子 
    if(this.chess[index]['status'] == 0){  // not opened 
      this.show(index);   
    }else if(this.chess[index]['status'] == 1){ // opened 
      if(this.chess[index]['type'] == this.chesstype[this.player]){ 
        this.select(index); 
      } 
    }     
  }else{ // 已选过棋子 
    if(index != this.selected['index']){        // 與selected不是同一位置 
      if(this.chess[index]['status'] == 0){      // 未打开的棋子 
        this.show(index); 
      }else if(this.chess[index]['status'] == -1){  // 點空白位置 
        this.move(index); 
      }else{                     // 點其他棋子 
        if(this.chess[index]['type']==this.chesstype[this.player]){ 
          this.select(index); 
        }else{      
          this.kill(index); 
        } 
      } 
    } 
  } 
} 

// show chess 
ChessClass.prototype.show = function(index){ 
  $(this.getid(index)).innerHTML = '<img src="images/' + this.chess[index]['chess'] + '.gif" />'; 
  this.chess[index]['status'] = 1;  // opened 
  if(this.selected!=null){      // 清空選中 
    $(this.getid(this.selected.index)).className = ''; 
    this.selected = null; 
  }   
  this.change_player(); 
  this.gameover(); 
} 

// select chess 
ChessClass.prototype.select = function(index){ 
  if(this.selected!=null){ 
    $(this.getid(this.selected['index'])).className = ''; 
  } 
  this.selected = {'index':index, 'chess':this.chess[index]}; 
  $(this.getid(index)).className = 'onsel'; 
} 

// move chess 
ChessClass.prototype.move = function(index){ 
  if(this.beside(index)){ 
    this.chess[index] = {'chess':this.selected['chess']['chess'], 'type':this.selected['chess']['type'], 'val':this.selected['chess']['val'], 'status':this.selected['chess']['status']}; 
    this.remove(this.selected['index']); 
    this.show(index); 
  } 
} 

// kill chess 
ChessClass.prototype.kill = function(index){ 
  if(this.beside(index)==true && this.can_kill(index)==true){ 
    this.chess[index] = {'chess':this.selected['chess']['chess'], 'type':this.selected['chess']['type'], 'val':this.selected['chess']['val'], 'status':this.selected['chess']['status']}; 
    this.remove(this.selected['index']); 
    var killed = this.player==1? 2 : 1; 
    $('grade_num' + killed).innerHTML = parseInt($('grade_num' + killed).innerHTML)-1;  
    this.show(index); 
  } 
} 

// remove chess 
ChessClass.prototype.remove = function(index){ 
  this.chess[index]['status'] = -1;  // empty 
  $(this.getid(index)).innerHTML = ''; 
  $(this.getid(index)).className = ''; 
} 

/* check is beside 
* @param index   目標棋子index 
* @param selindex  执行的棋子index,可为空, 为空则读取选中的棋子 
*/ 
ChessClass.prototype.beside = function(index,selindex){ 
  if(typeof(selindex)=='undefined'){ 
    if(this.selected!=null){ 
      selindex = this.selected['index']; 
    }else{ 
      return false; 
    } 
  } 

  if(typeof(this.chess[index])=='undefined'){ 
    return false; 
  } 

  var from_info = this.getid(selindex).split('_'); 
  var to_info = this.getid(index).split('_'); 
  var fw = parseInt(from_info[0]); 
  var fc = parseInt(from_info[1]); 
  var tw = parseInt(to_info[0]); 
  var tc = parseInt(to_info[1]); 

  if(fw==tw && Math.abs(fc-tc)==1 || fc==tc && Math.abs(fw-tw)==1){  // row or colunm is same and interval=1 
    return true; 
  }else{ 
    return false; 
  } 
} 

/* check can kill 
* @param index   被消灭的棋子index 
* @param selindex  执行消灭的棋子index,可为空, 为空则读取选中的棋子 
*/ 
ChessClass.prototype.can_kill = function(index,selindex){ 
  if(typeof(selindex)=='undefined'){ // 没有指定执行消灭的棋子 
    if(this.selected!=null){    // 有选中的棋子 
      selindex = this.selected['index']; 
    }else{ 
      return false; 
    } 
  } 
  if(this.chess[index]['type']!=this.chesstype[this.player]){ 
    if(parseInt(this.chess[selindex]['val'])==7 && parseInt(this.chess[index]['val'])==1){ // 7 can kill 1 
      return true; 
    }else if(parseInt(this.chess[selindex]['val'])==1 && parseInt(this.chess[index]['val'])==7){ // 1 can't kill 7 
      return false; 
    }else if(parseInt(this.chess[selindex]['val']) <= parseInt(this.chess[index]['val'])){  // small kill big 
      return true; 
    } 
  } 
  return false; 
} 

// change player 
ChessClass.prototype.change_player = function(){ 
  if(this.player == 1){ 
    this.player = 2;  // to green 
    $('grade_img2').className = 'img_on'; 
    $('grade_img1').className = 'img'; 
  }else{ 
    this.player = 1;  // to red 
    $('grade_img1').className = 'img_on'; 
    $('grade_img2').className = 'img'; 
  } 
} 

// reset grade 
ChessClass.prototype.reset_grade = function(){ 
  $('grade_img1').className = 'img_on'; 
  $('grade_img2').className = 'img'; 
  $('grade_num1').innerHTML = $('grade_num2').innerHTML = 16; 
  $('grade_res1').className = $('grade_res2').className = 'none'; 
  $('grade_res1').innerHTML = $('grade_res2').innerHTML = ''; 
} 

// game over 
ChessClass.prototype.gameover = function(){ 
  if($('grade_num1').innerHTML==0 || $('grade_num2').innerHTML==0){  // 任一方棋子为0 
    this.isover = 1; 
    this.show_grade(); 
    disp('init_div','show'); 
  }else{ 
    if(this.can_action()==false){ 
      this.isover = 1; 
      this.show_grade(); 
      disp('init_div','show'); 
    } 
  } 
} 

// show grade 
ChessClass.prototype.show_grade = function(){ 
  var num1 = parseInt($('grade_num1').innerHTML); 
  var num2 = parseInt($('grade_num2').innerHTML); 
  if(num1>num2){ // 红方胜 
    $('grade_res2').innerHTML = 'LOSS'; 
    $('grade_res2').className = 'loss'; 
    $('grade_res1').innerHTML = 'WIN'; 
    $('grade_res1').className = 'win'; 
  }else if(num1<num2){ // 黑方胜 
    $('grade_res1').innerHTML = 'LOSS'; 
    $('grade_res1').className = 'loss'; 
    $('grade_res2').innerHTML = 'WIN'; 
    $('grade_res2').className = 'win'; 
  }else{ // 平局 
    $('grade_res1').innerHTML = $('grade_res2').innerHTML = 'DRAW'; 
    $('grade_res1').className = $('grade_res2').className = 'draw'; 
  } 
} 

// check chess can action 
ChessClass.prototype.can_action = function(){ 
  var chess = this.chess; 
  for(var i=0,max=chess.length; i<max; i++){ 
  if(chess[i].status==0){ // 有未翻开的棋子 
    return true; 
  }else{ 
    if(chess[i].status==1 && chess[i].type==this.chesstype[this.player]){  // 己方已翻开的棋子 
      if(this.beside(i-this.boardcols, i) && (chess[i-this.boardcols].status==-1 || this.can_kill(i-this.boardcols,i) )){ // 上 
        return true; 
      } 
      if(this.beside(i+this.boardcols, i) && (chess[i+this.boardcols].status==-1 || this.can_kill(i+this.boardcols,i) )){ // 下 
        return true; 
      } 
      if(this.beside(i-1, i) && (chess[i-1].status==-1 || this.can_kill(i-1,i) )){  // 左 
        return true; 
      } 
      if(this.beside(i+1, i) && (chess[i+1].status==-1 || this.can_kill(i+1,i) )){  // 右 
        return true; 
      } 
    } 
  } 
  } 
  return false; 
} 

/** common function */ 

// get document.getElementBy(id) 
function $(id){ 
  this.id = id; 
  return document.getElementById(id); 
} 

// get document.getElementsByTagName 
function $_tag(name, id){ 
  if(typeof(id)!='undefined'){ 
    return $(id).getElementsByTagName(name); 
  }else{ 
    return document.getElementsByTagName(name);  
  } 
} 

/* div show and hide 
* @param id dom id 
* @param handle show or hide 
*/ 
function disp(id, handle){ 
  if(handle=='show'){ 
    $(id).style.display = 'block'; 
  }else{ 
    $(id).style.display = 'none';   
  } 
} 

/* img preload 
* @param img    要加载的图片数组 
* @param callback  图片加载成功后回调方法 
*/ 
function img_preload(img, callback){ 
  var onload_img = 0; 
  var tmp_img = []; 
  for(var i=0,imgnum=img.length; i<imgnum; i++){ 
    tmp_img[i] = new Image(); 
    tmp_img[i].src = img[i]; 
    if(tmp_img[i].complete){ 
      onload_img ++; 
    }else{ 
      tmp_img[i].onload = function(){ 
        onload_img ++; 
      } 
    } 
  } 
  var et = setInterval( 
    function(){ 
      if(onload_img==img.length){ // 定时器,判断图片完全加载后调用callback 
        clearInterval(et); 
        callback(); 
      } 
    },200); 
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>高亮的表格</title>
<meta http-equiv="content-type"
 content="text/html; charset=iso-8859-1" />
<style>
p, td, th {
  font: 0.8em Arial, Helvetica, sans-serif;
}
.datatable {
  border: 1px solid #D6DDE6;
  border-collapse: collapse;
  width: 80%;
}
.datatable td {
  border: 1px solid #D6DDE6;  
  padding: 4px;
}
.datatable th {
  border: 1px solid #828282;
  background-color: #BCBCBC;
  font-weight: bold;
  text-align: left;
  padding-left: 4px;
}
.datatable caption {
  font: bold 0.9em Arial, Helvetica, sans-serif;
  color: #33517A;
  text-align: left;
  padding-top: 3px;
  padding-bottom: 8px;
}
.datatable tr:hover, .datatable tr.hilite {
  background-color: #DFE7F2;
  color: #000000;
}
</style>
</head>
<body>
<table summary="List of new students 2003" class="datatable">
 <caption>Student List</caption>
 <tr>
 <th scope="col">Student Name</th>
 <th scope="col">Date of Birth</th>
 <th scope="col">Class</th>
 <th scope="col">ID</th>
 </tr>
 <tr>
 <td>Joe Bloggs</td>
 <td>27/08/1997</td>
 <td>Mrs Jones</td>
 <td>12009</td>
 </tr>
 <tr>
 <td>William Smith</td>
 <td>20/07/1997</td>
 <td>Mrs Jones</td>
 <td>12010</td>
 </tr>
 <tr>
 <td>Jane Toad</td>
 <td>21/07/1997</td>
 <td>Mrs Jones </td>
 <td>12030</td>
 </tr>
 <tr>
 <td>Amanda Williams</td>
 <td>19/03/1997</td>
 <td>Mrs Edwards</td>
 <td>12021</td>
 </tr>
</table>
<script type="text/javascript">
var rows = document.getElementsByTagName('tr');
for (var i = 0; i < rows.length; i++) {
  rows[i].onmouseover = function() {
    this.className += ' hilite';
  }
  rows[i].onmouseout = function() {
    this.className = this.className.replace('hilite', '');
  }
}
</script>
</body>
</html>

一体化实例代码点击那里本站下载.rar)。

盼望本文所述对大家的javascript程序设计有所协助。

深信本文所述对大家javascript游戏设计的上学有确定的借鉴价值。

你大概感兴趣的稿子:

  • 基于JavaScript达成动态创制表格和充实表格行数
  • JS组件Bootstrap
    Table表格行拖拽效果落到实处代码
  • JS完结的报表行鼠标点击高亮效果代码
  • javascript实现对表格成分举行排序操作
  • JavaScript怎么样动态创立table表格
  • js操作table成分达成表格行列新扩张、删除技能计算
  • js获取表格的行数和列数的点子
  • JavaScript获得表格(table)当前行的值、删除行、增添行
  • 原生JS和JQuery动态拉长、删除表格行的不贰秘籍
  • JavaScript对表格或因素按文件,数字或日期排序的法子
  • JS达成的表格操作类详解(增加,删除,排序,上移,下移)

您或者感兴趣的稿子:

  • 纯JS达成伍子棋游戏包容各浏览器(附源码)
  • Javascript和HTML5使用canvas创设Web五子棋游戏完结算法
  • JavaScript
    井字棋人工智能落成代码
  • javascript
    柒行代码画出七个围棋棋盘
  • 中夏族民共和国象棋js代码,仅演示,未能真下
  • 诘屈聱牙之javascript中华夏族民共和国象棋
  • js 钻石棋网络电子游艺代码
  • 原生JS+Canvas完结5子棋游戏实例
  • 原生JS+Canvas落成五子棋游戏
  • 基于JavaScript达成5子棋游戏

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*
*
Website