https://v9.infinitusweb.com.br/forum_sc/control_radio_com_imagens/
ONSCRIPTINIT
[iw]=new StdClass;
[iw]->path_img=sc_url_library("sys", "MyImages", "geral/");;
ONLOAD
[CODE]$_img[]=[iw]->path_img.‘clear_filters.png’;
$_img[]=[iw]->path_img.‘clear_filters26.png’;
$_img[]=[iw]->path_img.‘Copy_16X16.png’;
$_img[]=[iw]->path_img.‘lupa.png’;
$_html=monta_radio($_img,2);
/* inspecionado elemento rádio para pegar id e o conteúdo html da div
| Img 1 |
Img 2 |
| Img 3 |
Img 4 |
*/
?>
<?php[/CODE]
EVENTO AJAX ONCLICK DO CAMPO CHECKBOX
[CODE]$_img=[];
if ({Atualiza_Radio}!=1):
$_img[]=[iw]->path_img.'clear_filters.png';
$_img[]=[iw]->path_img.'clear_filters26.png';
$_img[]=[iw]->path_img.'Copy_16X16.png';
$_img[]=[iw]->path_img.'lupa.png';
$cols=2;
else:
$_img[]=[iw]->path_img.'clear_filters.png';
$_img[]=[iw]->path_img.'clear_filters26.png';
$_img[]=[iw]->path_img.'Copy_16X16.png';
$_img[]=[iw]->path_img.'lupa.png';
$_img[]=[iw]->path_img.'checkbox_no.jpg';
$_img[]=[iw]->path_img.'checkbox_yes.jpg';
$cols=3;
endif;
$_html=monta_radio($_img,$cols);
sc_ajax_javascript('fjs_troca_html',array('idAjaxRadio_radio_img',$_html));[/CODE]
METODO MONTA RADIO
[CODE]
function monta_radio($arr_img=[], $cols=1)
{
$_icols=0;
$_count=count($arr_img);
$_html="
";
for ($i = 1; $i <= $_count; $i++) {
$_html.="![]() |
";
$_icols++;
if ($_icols==$cols):
$_html.=' |
';
$_icols=0;
if ($i>$_count) $_html.='';
endif;
}
$_html.="
";
return $_html;
}
[/CODE]
TAGS:HAROLDO, IMAGENS, CAMPO, RADIO, DINAMICO