找回密码
 立即注册

QQ登录

只需一步,快速开始

iceman

社区贡献组

270

主题

1万

帖子

1万

积分

社区贡献组

积分
19311

活字格认证微信认证勋章元老葡萄

iceman
社区贡献组   /  发表于:2012-3-14 13:45  /   查看:5778  /  回复:0
这篇文章介绍如何使用 JS 设置行背景色,及如何锁定行。

JS 代码:
  1.     <script language="javascript" type="text/javascript">
  2. <!--

  3.         function Button1_onclick() {
  4.             var spread = document.all("FpSpread1");
  5.             var table = FpSpread1.all("FpSpread1_Viewport");
  6.             var tr = table.rows(spread.ActiveRow);
  7.             tr.bgColor = "Red";

  8.             var iActiveRow, iActiveCol;
  9.             //循环次数为 Spread 列数
  10.             for (var i = 0; i < 4; i++) {
  11.                 iActiveRow = FpSpread1.ActiveRow;
  12.                 var cell = FpSpread1.GetCellByRowCol(iActiveRow, i);
  13.                 cell.setAttribute("FpCellType", "readonly");
  14.             }
  15.         }

  16. // -->
  17.     </script>
复制代码
设置前图片

png

png

设置后图片

png

png

Demo 下载:
测试环境:VS 2010 &amp;&amp; Spread for ASP.NET 5.0
3615.zip (2.77 MB, 下载次数: 349)

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部