大小复选框 [英] size checkboxes

查看:87
本文介绍了大小复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将复选框变大?到目前为止,我所阅读的消息来源说这几乎是不可能的.

Is it possible to make a checkbox large? So far, the sources i've read said that it's nearly impossible.

我已经尝试过Cssclasses,但也没有用.我不想作弊并使用TextBox.

I've tried Cssclasses and it didn't work either. I don't want to cheat and use a TextBox.

如何使复选框更大?

推荐答案

您可能必须使用JavaScript交换图像,并且要提交隐藏字段.

You'll probably have to swap an image out with JavaScript and have a hidden field you're submitting.

这是一个非常原始(未经测试)的示例,但这仅是为您提供了想法.如果要创建复选框列表,则必须对存储在隐藏字段中的值有所了解,例如在JavaScript中维护数组并使用连接列表更新隐藏字段.

This is a very primitive (and untested) example, but it's just to give you the idea. If you're doing a list of checkboxes, then you'll have to get fancy with the value you're storing in the hidden field, like maintaining an array in JavaScript and updating the hidden field with a concatenated list.

<img src="checked.gif" onclick="toggle()" id="imgCheck"/>
<input type="hidden" id="hdnValue" value="true"/>
<script>
function toggle() {
   var hdnValue = document.getElementById('hdnValue');
   var imgCheck = document.getElementById('imgCheck');
   if(hdnValue.value == 'true') {
      hdnValue.value = 'false';
      imgCheck.src = 'unchecked.gif';
   }else{
      hdnValue.value = 'true';
      imgCheck.src = 'checked.gif';
   }
}
</script>

希望有帮助.

这篇关于大小复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆