Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

DannyND

Passar checkbox marcado por javascript

Recommended Posts

Olá pessoal,

 

Preciso gerar um relatório onde seleciono os campos que devem aparecer, porém estou com problemas para enviar as marcações dos checkbox que sempre passam como ON.

 

<script>
function relatorio()
{
with(rel_cliente)
{
window.open('ti_rel_clientes.php?opc=1&ft_cli='+ft_cli.value+'&ft_uf='+ft_uf.value+'&ft_cidade='+ft_cidade.value+'&ft_cnpj='+ft_cnpj.value+'
&ft_repres='+ft_repres.value+'&status='+status.value+'&classe='+classe.value+'&ordem='+ordem.value+'&dt_ini='+dt_ini.value+'
&dt_inc='+dt_inc.value+'&dt_incf='+dt_incf.value+'&limite1='+limite1.value+'&limite2='+limite2.value+'&ch1='+ch1.value+'&ch2='+ch2.value+'
&ch3='+ch3.value+'&ch4='+ch4.value+'&ch5='+ch5.value+'&ch6='+ch6.value+'&ch7='+ch7.value+'&ch8='+ch8.value+'&ch9='+ch9.value+'
&ch10='+ch10.value+'&ch11='+ch11.value+'&ch12='+ch12.value+'&ch13='+ch13.value+'&ch14='+ch14.value+'&ch15='+ch15.value+'
&ch16='+ch16.value+'&ch17='+ch17.value+'&ch18='+ch18.value,'RelCliente',
'top=10,left=10,height=560,width=1300,menubar=yes,titlebar=no,scrollbars=yes,status=no,resizeable=yes')
	}
}


function selecionar_tudo(){ 
	   for (i=0;i<document.rel_cliente.elements.length;i++) 
		  if(document.rel_cliente.elements[i].type == "checkbox") 
			 document.rel_cliente.elements[i].checked=1 
} 

function deselecionar_tudo(){ 
	   for (i=0;i<document.rel_cliente.elements.length;i++) 
		  if(document.rel_cliente.elements[i].type == "checkbox") 
			 document.rel_cliente.elements[i].checked=0 
}
</script>
<form name='rel_cliente' method='post'>
	<center>
		<table width='840' border='0' cellpadding='2' cellspacing='0' style='border:1 solid black'>
		<tr><td colspan=4 align='center' class='tt'>Relatório de Clientes</td></tr>
		<tr>
			<td align='right' width='25%' class='fpp1'>Nome Cliente:</td>
			<td><input type='text' value='<?=$ft_cli?>' name='ft_cli' size='50' maxlength='50'></td>
			<td align='right' colspan='2'>
			<?if($tp_priv=='S'):?><A HREF="ti_cli_suf.php" target='_blank'><FONT FACE='tahoma' SIZE=1 color='black'> Clientes Suframa </font></A><?endif;?>
			</td>
		</tr>
...
		<tr>
			<table width='840' border='0' cellpadding='2' cellspacing='0' style='border:1 solid black'>
				<tr>
				<td class='fpp1' colspan='2'>Selecionar campos <a href="javascript:selecionar_tudo()" class='linkb'>Marcar todos</a> | <a href="javascript:deselecionar_tudo()" class='linkb'>Desmarcar todos</a></td>
				</tr>
				<tr>
				<td class='fpp1'>
					<input type="checkbox" name="ch1" id='check'>Categoria
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch5" id='check'>Nome
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch2" id='check'>Situação
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch3" id='check'>Limite
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch4" id='check'>Código Bosch
				</td>
				</tr>
				<tr>
				<td class='fpp1'>
					<input type="checkbox" name="ch6" id='check'>Endereço
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch7" id='check'>Nº
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch8" id='check'>Bairro
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch9" id='check'>CEP
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch10" id='check'>Cidade
				</td>
				</tr>
				<tr>
				<td class='fpp1'>
					<input type="checkbox" name="ch11" id='check'>UF
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch12" id='check'>Contato
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch13" id='check'>Telefone
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch14" id='check'>E-mail
				</td>
				</tr>
				<tr>
				<td class='fpp1'>
					<input type="checkbox" name="ch15" id='check'>CNPJ
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch16" id='check'>Última Compra
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch17" id='check'>Data Inclusão
				</td>
				<td class='fpp1'>
					<input type="checkbox" name="ch18" id='check'>Representante
				</td>
				</td>
			</tr>
		</table>
		</tr>
		<tr>
			<td colspan=6 align='center'>
				<input type='button' value=' Gerar Relatório ' class='botao' onClick='relatorio()'>
				<input type='button' value=' Gerar Etiquetas '   class='botao' onclick='impEtiq()'>
				<input type='button' value=' Exportar Excel ' class='botao' onClick='impExcel()'>
			</td>
		</tr>
		<tr><td> </td></tr>
	</table>
</form>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.