<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="js/knockout-3.4.0.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div data-bind="style: { color: currentProfit() < 0 ? 'red' : 'black' }">
Profit Information
</div>
<script type="text/javascript">
var viewModel = {
currentProfit: ko.observable(150000)
};
viewModel.currentProfit(-50);
ko.applyBindings(viewModel);

//css 中如果想 font-style 需要这样写 fontStyle

// 对应表:
// http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html

</script>

</body>
</html>

相关文章:

  • 2021-08-03
  • 2022-01-08
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2021-05-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案