需求:点击某个li修改其颜色,其它还原。
-
注意:实现此功能,必须要给每个li添加tabindex='1'属性
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <style> #com_header{ width: 100%; height: 60px; background-color: #3667AB; }; #com_headtop{ } #com_headtop>li{ float: left; width: 150px; height: 60px; line-height: 60px; text-align: center; color: #fff; cursor:pointer;