ArthurXF是BIWEB WMS开源系统的创始人,关于BIWEB WMS开源系统的介绍,可以访问biweb.cn
  smarty里面的{html_checkboxes}是用来自动生成html的checkbox的,非常方便和实用。例如下面的例子:

$smarty->assign('cust_checkboxes', array(
                                    1000 => 'Joe Schmoe',
                                    1001 => 'Jack Smith',
                                    1002 => 'Jane Johnson',
                                    1003 => 'Charlie Brown')
                                  );
$smarty->assign('customer_id', 1001);

?>  

上面的赋值在模版里写入下面的smarty语句

{html_checkboxes name='id' options=$cust_checkboxes  selected=$customer_id separator='
'}

就可以自动生成下面的html代码。多简单省事啊。










不过当我们需要在下面的input上加onclick事件如何来写呢?手册上也没看到例子,并且写的不明不白。我ArthurXF本以后要去扩展smarty了,谁知道看了源代码之后发现要实现这个功能太容易了。请看我写的例子。

{html_checkboxes name='id' options=$cust_checkboxes  selected=$customer_id separator='
' onclick="alert('ok')"}

这样就可以了,呵呵,是不是非常简单啊?请转载的兄弟姐妹,帮忙推广一下BIWEB WMS开源系统。biweb.cn
PHP | 评论(0) | 引用(0) | 阅读(4429)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]