【发布时间】:2010-03-04 19:03:43
【问题描述】:
我使用这段代码来确定复选框的宽度和高度:
var chk = $('input[type="checkbox"]:first');
chkWidth = chk.innerWidth()
+ parseInt(chk.css('margin-left').replace('px', ''))
+ parseInt(chk.css('margin-right').replace('px', '')); /*IS there better way instead of px replace?? */
chkHeight = chk.innerHeight()
+ parseInt(chk.css('margin-top').replace('px', ''))
+ parseInt(chk.css('margin-bottom').replace('px', ''));
fieldWidth = gamefield.innerWidth();
fieldHeight = gamefield.innerHeight();
然后我尝试用完全适合给定 div 的复选框数量填充 div。事实上,我从 div 中得到了很多复选框。
有没有办法解决这个问题?谢谢!
【问题讨论】:
-
填充div的代码是什么?
-
愚蠢的无关问题,复选框如何与俄罗斯方块相关联?谢谢。
标签: javascript jquery html css