显示多列无线电列表的列表 [英] display a list of radio boxes in multiple columns

查看:85
本文介绍了显示多列无线电列表的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个php循环列出了50个广播框。
我想在每列上放10个广播框。我试过:


div style =overflow:hidden; white-space:nowrap;
float:left; width:160px ;>


生成代码:

  {php} $ j = 0; {/ php} 
{foreach from = $ genreLists item = genreList key = genre_key}
{if $ genre_key< = 250}
div id =genrecheck _ {$ genreList}>
input name =genre []type =checkboxid =genre []value ={$ genreList}{section name = rows loop = $ smarty.request.genre} {if $ genreList == $ smarty.request.genre [rows]} checked {/ if} {/ section} onClick =getval(this,'genrecheck _ {$ genreList}');>
div id =genre _ {$ genre_key}style =display:none;> {$ genreList} / div> div id =genre1 _ {$ genre_key}style =display:inline;> ; {$ genreList} / div>
/ div>
{php} $ j ++; if($ j%5 == 0){echo
; $ J = 0; } {/ php} {/ if} {/ foreach}

它似乎不起作用。有什么建议么?请注意:收音机框会使用php循环进行回显。

类= 行 >
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< input type =radioname =Row1/>
< / div>
< div class =Row>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< input type =radioname =Row2/>
< / div>
< div class =Row>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< input type =radioname =Row3/>
< / div>
< div class =Row>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< input type =radioname =Row4/>
< / div>
< div class =Row>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< input type =radioname =Row5/>
< / div>


I have a php loop that lists 50 radio boxes. I want to put 10 radio boxes on each column. I tried:

div style="overflow:hidden; white-space:nowrap; float:left;width:160px;">

generating code:

 {php} $j=0; {/php} 
                {foreach from=$genreLists item=genreList key = genre_key}
                {if $genre_key <= 250}
                div id="genrecheck_{$genreList}">
              input name="genre[]" type="checkbox" id="genre[]" value="{$genreList}" {section  name = rows loop = $smarty.request.genre} {if $genreList ==  $smarty.request.genre[rows]} checked {/if}{/section} onClick="getval(this,'genrecheck_{$genreList}');">
                div id="genre_{$genre_key}" style="display:none;">{$genreList}/div>div id="genre1_{$genre_key}" style="display:inline;">{$genreList} /div>
                /div>
                {php} $j++; if($j%5==0) { echo "
                "; $j=0; } {/php} {/if}{/foreach}

it seems like its not working. Any suggestions? please note: the radio boxes are echoed using a php loop.

解决方案

<div class="Row">
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
  <input type="radio" name="Row1" />
</div>
<div class="Row">
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
  <input type="radio" name="Row2" />
</div>
<div class="Row">
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
  <input type="radio" name="Row3" />
</div>
<div class="Row">
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
  <input type="radio" name="Row4" />
</div>
<div class="Row">
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
  <input type="radio" name="Row5" />
</div>

这篇关于显示多列无线电列表的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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