更改checkbox效果 checkbox的默认被选中效果是在框里画了个钩,我想用JS把它改成一个全黑的框,有什么办法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用2张图片,勾选和未勾选将checkbox样式 style="filter:alpha(opacity=0);opacity:0" IE 下可以这么玩,FF 下不行,可以考虑用 div 遮罩实现L@_@K<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> </head> <body> <input type="checkbox" id="iptChk1" /> <input type="checkbox" id="iptChk2" /> <script type="text/javascript"> <!--var chk = document.getElementById("iptChk1");chk.onclick = function() { if (this.checked) { this.style.border = "solid 10px black"; } else { this.style.border = "solid 0px black"; }}; //--> </script> </body></html> 不错,呵呵能不能让黑框的大小和checkbox内框大小一样?给人的感觉就像把框内涂成了黑色 IE 7 下可以达到 lz 要求,FF 行不通!不过 margin-top 居然是 -22px 才能达到效果,太诡异了!写着玩吧!L@_@K<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> </head> <body> <div style="width: 12px; height: 12px; border: solid 0px red; overflow: hidden; margin-bottom: 5px;"> <input type="checkbox" id="iptChk1" style="margin: -22px 0px 0px -4px;" /> </div> <div style="width: 12px; height: 12px; border: solid 0px red; overflow: hidden; margin-bottom: 5px;"> <input type="checkbox" id="iptChk2" style="margin: -22px 0px 0px -4px;" /> </div> <script type="text/javascript"> <!--var chk = document.getElementById("iptChk1");chk.onclick = function() { if (this.checked) { this.style.border = "solid 10px black"; } else { this.style.border = "solid 0px black"; }}; //--> </script> </body></html> 请教字符串的问题 寻js实现像Ubuntu那样的窗口移动时变形效果 CSS样式还原问题,或样式过渡保存问题? 图片前换问题 javascript高手请进 怎么根据条件让一行数据变颜色 prompt为何出不来 超级简单问题!up有分! 关于SELECT列表框添加值的问题 请帮我解决Checkbox的问题 网页是否支持类似于网格的操作 求教一下高手,这段验证代码算法怎么来反算一下得出密码 code=-34 javascript 变量赋值问题
将checkbox样式 style="filter:alpha(opacity=0);opacity:0"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head> <body>
<input type="checkbox" id="iptChk1" />
<input type="checkbox" id="iptChk2" />
<script type="text/javascript">
<!--
var chk = document.getElementById("iptChk1");
chk.onclick = function() {
if (this.checked)
{
this.style.border = "solid 10px black";
}
else
{
this.style.border = "solid 0px black";
}
};
//-->
</script>
</body>
</html>
能不能让黑框的大小和checkbox内框大小一样?给人的感觉就像把框内涂成了黑色
IE 7 下可以达到 lz 要求,FF 行不通!
不过 margin-top 居然是 -22px 才能达到效果,太诡异了!写着玩吧!L@_@K
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head> <body>
<div style="width: 12px; height: 12px; border: solid 0px red; overflow: hidden; margin-bottom: 5px;">
<input type="checkbox" id="iptChk1" style="margin: -22px 0px 0px -4px;" />
</div>
<div style="width: 12px; height: 12px; border: solid 0px red; overflow: hidden; margin-bottom: 5px;">
<input type="checkbox" id="iptChk2" style="margin: -22px 0px 0px -4px;" />
</div>
<script type="text/javascript">
<!--
var chk = document.getElementById("iptChk1");
chk.onclick = function() {
if (this.checked)
{
this.style.border = "solid 10px black";
}
else
{
this.style.border = "solid 0px black";
}
};
//-->
</script>
</body>
</html>