Chinaunix首页 | 论坛 | 博客
  • 博客访问: 220573
  • 博文数量: 47
  • 博客积分: 1485
  • 博客等级: 上尉
  • 技术积分: 475
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-14 18:07
个人简介

一人,一生,一条路!

文章分类

全部博文(47)

文章存档

2015年(1)

2014年(2)

2013年(1)

2012年(1)

2010年(2)

2009年(2)

2008年(1)

2007年(3)

2006年(9)

2005年(25)

我的朋友

分类: Web开发

2014-08-22 09:09:26


样式

名称 描述
垂直式 (默认) .form-vertical (非必填,默认) 堆叠式的,所有控件的标签文字都左对齐
行式 .form-inline 标签文字左对齐,控件以inline-block紧凑形式存在
搜索式 .form-search 经典的搜索美化方案,对文本框进行圆化
水平式 .form-horizontal 左浮动,标签与其对应的控件居于同一行,标签文字右对齐

支持的表单控件


Inputs

  1. <input type="text" placeholder="Text input">  

Textarea

  1. <textarea rows="3">textarea>  

Checkboxes and radios

  1. <label class="checkbox">  
  2.   <input type="checkbox" name="optionCheckbox" value="sure">  
  3.   Option one is this and that—be sure to include why it's great  
  4. label>  
  5.    
  6. <label class="radio">  
  7.   <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>  
  8.   Option one is this and that—be sure to include why it's great  
  9. label>  
  10. <label class="radio">  
  11.   <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">  
  12.   Option two can be something else and selecting it will deselect option one  
  13. label>  

  1. <label class="checkbox inline">  
  2.   <input type="checkbox" name="inlineCheckbox1" value="option1"> 1  
  3. label>  
  4. <label class="checkbox inline">  
  5.   <input type="checkbox" name="inlineCheckbox2" value="option2"> 2  
  6. label>  
  7. <label class="checkbox inline">  
  8.   <input type="checkbox" name="inlineCheckbox3" value="option3"> 3  
  9. label>  

Selects

  1. <select>  
  2.   <option>1option>  
  3.   <option>2option>  
  4.   <option>3option>  
  5.   <option>4option>  
  6.   <option>5option>  
  7. select>  
  8.    
  9. <select multiple="multiple">  
  10.   <option>1option>  
  11.   <option>2option>  
  12.   <option>3option>  
  13.   <option>4option>  
  14.   <option>5option>  
  15. select> 

扩展表单控件


前置&后置输入框

使用文本:
  1. <div class="input-prepend">  
  2.   <span class="add-on">@span>  
  3.   <input class="span2" id="prependedInput" type="text" placeholder="Username">  
  4. div>  
  5. <div class="input-append">  
  6.   <input class="span2" id="appendedInput" type="text">  
  7.   <span class="add-on">.00span>  
  8. div>  

也可使用按钮:
  1. <div class="input-append">  
  2.   <input class="span2" id="appendedInputButton" type="text">  
  3.   <button class="btn" type="button">Go!button>  
  4. div>  

下拉按钮:
  1. <div class="input-append">  
  2.   <input class="span2" id="appendedDropdownButton" type="text">  
  3.   <div class="btn-group">  
  4.     <button class="btn dropdown-toggle" data-toggle="dropdown">  
  5.       Action  
  6.       <span class="caret">span>  
  7.     button>  
  8.     <ul class="dropdown-menu">  
  9.       ...  
  10.     ul>  
  11.   div>  
  12. div>  

分割的下拉按钮:
  1. <form>  
  2.   <div class="input-prepend">  
  3.     <div class="btn-group">...div>  
  4.     <input type="text">  
  5.   div>  
  6.   <div class="input-append">  
  7.     <input type="text">  
  8.     <div class="btn-group">...div>  
  9.   div>  
  10. form>  

搜索框:
  1. <form class="form-search">  
  2.   <div class="input-append">  
  3.     <input type="text" class="span2 search-query">  
  4.     <button type="submit" class="btn">Searchbutton>  
  5.   div>  
  6.   <div class="input-prepend">  
  7.     <button type="submit" class="btn">Searchbutton>  
  8.     <input type="text" class="span2 search-query">  
  9.   div>  
  10. form>  

控制大小

或者'; tpl += '
'; tpl += '
'; tpl += '
'; tpl += ''; tpl += '
'; tpl += '
'; tpl += '
'; $('.z_move_comment').html(''); $(this).parents('.Blog_right1_8').find('.z_move_comment').html(tpl).show(); }); //引用的评论提交 $('#quota_sbumit').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var bid = $(this).attr('bid'); var tid = $(this).attr('tid');//被引用人的id var qid = $(this).attr('cid');//引用的id var url = $(this).attr('url'); var text = $('#rmsg').val(); var tname = $(this).attr('tname'); if(text == '' || text=='文明上网,理性发言...') { showErrorMsg('评论内容不能为空!' , '消息提示'); return false; } else { if(mb_strlen(text) > 1000){ showErrorMsg('评论内容不能超过500个汉字' , '消息提示'); return false; } } $.ajax({ type: "post", url: url , data: {'bid': bid , 'to' : tid , 'qid' : qid , 'text': text , 'tname' : tname }, dataType: 'json', success: function(data){ if(data.code == 1){ var tpl = '
'; tpl+= ''; tpl+= '
'; tpl+= '

' + data.info.username + '' + data.info.dateline + '

'; tpl+= '

' + data.info.quota.username + ':'+ data.info.quota.content + '

'; tpl+= '

' + data.info.content + '

回复 |  删除 |  举报
'; tpl+= ''; tpl+= '
'; $('#replyList .Blog_right1_8:first').before(tpl); $('.z_move_comment').html('').hide(); } else if(data.code == -1){ //showErrorMsg(data.info , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); } }, error: function(){//请求出错处理 } }); }); //底部发表评论 $('#submitmsg').click(function(){ if(allowComment == 1) { showErrorMsg('该博文不允许评论' , '消息提示'); return false; } var bid = $(this).attr('bid'); var toid = $(this).attr('toid'); var text = $('#reply').val(); var url = $(this).attr('url'); if(text == '' || text=='文明上网,理性发言...') { showErrorMsg('评论内容不能为空!' , '消息提示'); return false; } else { if(mb_strlen(text) > 1000){ showErrorMsg('评论内容不能超过500个汉字' , '消息提示'); return false; } } $.ajax({ type: "post", url: url , data: {'bid': bid , 'to' : toid ,'text': text}, dataType: 'json', success: function(data){ if(data.code == 1) { var tpl = '
'; tpl += ''; tpl += '
'; tpl += '

' + data.info.username + '' + data.info.dateline + '

'; tpl += '

' + data.info.content + '

'; tpl += '
回复 |  删除 |  举报
'; tpl += ''; tpl += '
'; $('.Blog_tit3:first').after(tpl); $('#reply').val('文明上网,理性发言...'); } else if(data.code == -1) { showErrorMsg(data.info , '消息提示'); } }, error: function(){//请求出错处理 } }); }); //底部评论重置 $('#reset_comment').click(function(){ $('#reply').val('文明上网,理性发言...'); }); //取消回复 $('#qx_comment').live('click' , function(){ $('.z_move_comment').html('').hide(); }); $('#rmsg, #reply').live({ focus:function(){ if($(this).val() == '文明上网,理性发言...'){ $(this).val(''); } }, blur:function(){ if($(this).val() == ''){ $(this).val('文明上网,理性发言...'); } } }); //删除留言确认 $('.comment_del_mark').live('click' , function(){ var url = $(this).attr('url'); asyncbox.confirm('删除留言','确认', function(action){ if(action == 'ok') { location.href = url; } }); }); //删除时间确认 $('.del_article_id').click(function(){ var delurl = $(this).attr('delurl'); asyncbox.confirm('删除文章','确认', function(action){ if(action == 'ok') { location.href = delurl; } }); }); /* //字数限制 $('#rmsg, #reply').live('keyup', function(){ var id = $(this).attr('id'); var left = Util.calWbText($(this).val(), 500); var eid = '#errmsg'; if(id == 'reply') eid = '#rerrmsg'; if (left >= 0) $(eid).html('您还可以输入' + left + '字'); else $(eid).html('您已超出' + Math.abs(left) + ''); }); */ //加载表情 $('#face').qqFace({id : 'facebox1', assign : 'reply', path : '/image/qqface/'}); $('#mface').qqFace({id : 'facebox', assign : 'rmsg', path:'/image/qqface/'}); /* $('#class_one_id').change(function(){ alert(123213); var id = parseInt($(this).val() , 10); if(id == 0) return false; $('.hidden_son_class span').each(function( index , dom ){ if( dom.attr('cid') == id ) { } }); }); */ //转载文章 var turn_url = "/blog/viewClassPart.html"; $('#repost_bar').click(function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var id = $(this).attr('bid'); asyncbox.open({ id : 'turn_class_thickbox', url : turn_url, title : '转载文章', width : 330, height : 131, scroll : 'no', data : { 'id' : id }, callback : function(action){ if(action == 'close'){ $.cover(false); } } }); }); /* //转发文章 $('#repost_bar').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var bid = $(this).attr('bid'); var url = $(this).attr('url'); asyncbox.confirm('转载文章','确认', function(action){ if(action == 'ok'){ $.ajax({ type:"POST", url:url, data: { 'bid' : bid }, dataType: 'json', success:function(msg){ if(msg.error == 0){ showSucceedMsg('转发成功!', '消息提示'); }else if(msg.error == 1){ //location.href = '/index.php?r=site/login'; showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); }else{ showErrorMsg(msg.error_content, '消息提示'); } } }); } }); }); */ });