<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/knockout-3.3.0.js"></script>
    <script type="text/javascript">
        var viewModel = {
            currentProfit: ko.observable(1)
        };
        $(function () {
            viewModel.currentProfit(-1);
            ko.applyBindings(viewModel);
        })
    </script>
</head>
<body>
    <div data-bind="style: { color: currentProfit() < 0 ? 'red' : 'black' }">
        Profit Information
    </div>
</body>

 

相关文章:

  • 2022-12-23
  • 2022-02-20
  • 2021-09-13
  • 2021-06-25
  • 2021-09-09
  • 2021-11-22
  • 2021-09-03
猜你喜欢
  • 2022-03-04
  • 2022-02-23
  • 2022-01-03
  • 2021-11-29
  • 2021-05-20
  • 2021-08-14
相关资源
相似解决方案