CSS学习系列三:伪类和伪元素
2010-03-13 17:01
471 查看
这个组件都比较简单,要配置的参数很少
radio和checkbox设置基本一样,就几个属性(checked,handler,boxLabel,inputValue),俩个的配置一样的可以比较着进行学习,checkboxgroup和radiogroup设置也是完全一样的,他们的属性主要包括:columns和vertical
运行代码就知道有多么容易了
checkbox.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>register.html</title> <style type="text/css"> body{background-color:#777777} #form-cb{width: 700px;margin-left: auto;margin-right: auto;} </style> <link rel="stylesheet" type="text/css" href="../Ext/resources/css/ext-all.css" /> <script type="text/javascript" src="../Ext/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="../Ext/ext-all.js"></script> <script type="text/javascript" src="checkbox.js"></script> </head> <body> <div id="form-cb"></div> </body> </html>
checkbox.js
Ext.onReady(function() { var form = new Ext.FormPanel({ title : 'checkbox应用', width : 600, autoHeight : true, renderTo : 'form-cb', bodyStyle : "padding:2px", border : false, frame : true, items : [{ autoHeight : true, xtype : 'fieldset', collapsible :true, collapsed :true, layout : 'form', title:'复选框', items:[{ xtype : 'checkbox', fieldLabel : '复选框', inputValue : '1',//选中值 checked :true,//是否被选中 handler :function(){Ext.Msg.alert('提示','你被选中了')}, name : 'b1', boxLabel : 'box1' },{ xtype : 'checkboxgroup', fieldLabel : '复选组autolayout', items :[{ inputValue : 'song', boxLabel : '唱歌', name : 'gb' },{ inputValue : 'dance', boxLabel : '跳舞', checked :true,//是否被选中 name : 'gb' },{ inputValue : 'swing', boxLabel : '游泳', name : 'gb' }] },{ xtype : 'checkboxgroup', fieldLabel : '复选组单列layout', columns: 1,//设置显示的列数 items :[{ inputValue : 'song', boxLabel : '唱歌', name : 'gb1' },{ inputValue : 'dance', boxLabel : '跳舞', name : 'gb1' },{ inputValue : 'swing', checked :true,//是否被选中 boxLabel : '游泳', name : 'gb1' }] },{ xtype : 'checkboxgroup', fieldLabel : '复选组多列layout', columns: 2,//设置显示的列数 items :[{ inputValue : 'song', boxLabel : '唱歌', name : 'gb2' },{ inputValue : 'dance', checked :true,//是否被选中 boxLabel : '跳舞', name : 'gb2' },{ inputValue : 'swing', checked :true,//是否被选中 boxLabel : '游泳', name : 'gb2' },{ inputValue : 'play', boxLabel : '打球', name : 'gb2' },{ inputValue : 'film', checked :true,//是否被选中 boxLabel : '看电影', name : 'gb2' }] },{ xtype : 'checkboxgroup', fieldLabel : '复选组多列layout(vertical=true)', columns: 2,//设置显示的列数 vertical :true,//表示组件分布方向是否为垂直方向,默认为false即水平方向 items :[{ inputValue : 'song', boxLabel : '唱歌', name : 'gb3' },{ inputValue : 'dance', checked :true,//是否被选中 boxLabel : '跳舞', name : 'gb3' },{ inputValue : 'swing', checked :true,//是否被选中 boxLabel : '游泳', name : 'gb3' },{ inputValue : 'play', boxLabel : '打球', name : 'gb3' },{ inputValue : 'film', checked :true,//是否被选中 boxLabel : '看电影', name : 'gb3' }] }] },{ autoHeight : true, xtype : 'fieldset', collapsible :true, collapsed :false, title:'单选框', layout : 'form', items:[{ xtype : 'radio', fieldLabel : '单选框', inputValue : '1',//选中值 checked :true,//是否被选中 handler :function(){Ext.Msg.alert('提示','你被选中了')}, name : 'b1', boxLabel : 'box1' },{ xtype : 'radiogroup', fieldLabel : '单选组autolayout', items :[{ inputValue : 'song', boxLabel : '唱歌', name : 'rb' },{ inputValue : 'dance', boxLabel : '跳舞', checked :true,//是否被选中 name : 'rb' },{ inputValue : 'swing', boxLabel : '游泳', name : 'rb' }] },{ xtype : 'radiogroup', fieldLabel : '单选组单列layout', columns: 1,//设置显示的列数 items :[{ inputValue : 'song', boxLabel : '唱歌', name : 'rb1' },{ inputValue : 'dance', boxLabel : '跳舞', name : 'rb1' },{ inputValue : 'swing', checked :true,//是否被选中 boxLabel : '游泳', name : 'rb1' }] },{ xtype : 'radiogroup', fieldLabel : '单选组多列layout', columns: 2,//设置显示的列数 items :[{ inputValue : 'song', boxLabel : '唱歌', name : 'rb2' },{ inputValue : 'dance', checked :true,//是否被选中 boxLabel : '跳舞', name : 'rb2' },{ inputValue : 'swing', checked :true,//是否被选中 boxLabel : '游泳', name : 'rb2' },{ inputValue : 'play', boxLabel : '打球', name : 'rb2' },{ inputValue : 'film', checked :true,//是否被选中 boxLabel : '看电影', name : 'rb2' }] },{ xtype : 'radiogroup', fieldLabel : '单选组多列layout(vertical=true)', columns: 2,//设置显示的列数 vertical :true,//表示组件分布方向是否为垂直方向,默认为false即水平方向 items :[{ inputValue : 'song', boxLabel : '唱歌', name : 'rb3' },{ inputValue : 'dance', checked :true,//是否被选中 boxLabel : '跳舞', name : 'rb3' },{ inputValue : 'swing', checked :true,//是否被选中 boxLabel : '游泳', name : 'rb3' },{ inputValue : 'play', boxLabel : '打球', name : 'rb3' },{ inputValue : 'film', checked :true,//是否被选中 boxLabel : '看电影', name : 'rb3' }] }] }], buttons : [{ text : '提交', scope : this, handler : function() { alert(Ext.encode(form.form.getValues())); } }, { text : '重置' }] }) })
源代码在下面,IE7.0和FF都没问题
相关文章推荐
- 前端学习 --Css -- 子元素的伪类
- css学习笔记20160128对齐组合选择符伪类伪元素
- 学习笔记---css中伪元素与伪类(迷惑我的:after与:hover)
- DIV+CSS 学习心得:分组,嵌套,伪类,伪元素
- HTML5学习系列——<progress>元素
- css 伪类/元素
- 系列文章--精通CSS.DIV网页样式与布局学习
- 利用CSS hover伪类改变其他元素的总结
- 初学CSS-浮动、盒子模型、伪类、伪元素、定位———Day4学习笔记
- 第二章 CSS工作原理(伪类与伪元素)
- CSS基础学习9-CSS设置浮动元素(float)
- 详解CSS中的伪类与伪元素及二者间的区别
- CSS 伪类与伪元素
- CSS中一些利用伪类、伪元素和相邻元素选择器的技巧
- 关于css的伪类和伪元素
- css系列(布局):实现一个元素在浏览器中水平、垂直居中的几个方案
- CSS中伪类和伪元素的区别
- CSS中伪类和伪元素的区别
- CSS中 伪类和伪元素的用法 --实现元素前后添加[]框