Ir para conteúdo

POWERED BY:

Arquivado

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

wolfphw

Enquete

Recommended Posts

Tipo to sofrendo aki... preciso abrir uma página pra quando eu votar na enquete ele abre um popup com os votos mas naum to conseguindo....

 

Como posso fazer isso usando JavaScript????

 

Que eu to usando mas o meu naum esta mandando os valores....

 

 

PHP

[*]

[*]<script language="javascript"><!-- 

[*]function EnviaFormulario(_form) {

[*] formularios = document.forms.length;

[*] for (i = 0; i < formularios; i++) {

[*] if (document.forms.name == _form) {

[*] formulario = i;

[*] break;

[*] }

[*] }

[*] _qtditens = document.forms[formulario].voto.length;

[*] _resp = _qtditens;

[*] for (i = 0; i < _qtditens; i++) {

[*] if (document.forms[formulario].voto.checked) {

[*] _resp = 1;

[*] }

[*] }

[*] if (_resp == _qtditens) {

[*] alert("Favor escolher uma alternativa!");

[*] } else {

[*] abrepagina('', 0, 0);

[*] document.forms[formulario].submit();

[*] }

[*]}

[*]// --></script>

[*]<?php

[*]

[*] include("../../secur/style.php");

[*]

[*] $data_enquete = date('Y\-m');

[*]

[*] $sql_enquete = mysql_query("SELECT idenquete, questao FROM enquete WHERE data = '$data_enquete'");

[*] $idenquete = mysql_fetch_row($sql_enquete);

[*]

[*] $sql_enquete_votos = mysql_query("SELECT idvotos FROM enquete_votos WHERE idenquete = '$idenquete[0]' ORDER BY idvotos");

[*] $sql_enquete_questoes = mysql_query("SELECT questoes FROM enquete_questoes WHERE idenquete = '$idenquete[0]' ORDER BY idquestoes");

[*]

[*] $votos_array = array();

[*] $questoes_array = array();

[*]

[*] $v_enquete = 0;

[*] $q_enquete = 0;

[*] $conta_enquete = 0;

[*]

[*] while ($aux_votos = mysql_fetch_row($sql_enquete_votos)) {

[*] $votos_array[$v_enquete] = $aux_votos[0];

[*] $v_enquete++;

[*] }

[*]

[*] while ($aux_questoes = mysql_fetch_row($sql_enquete_questoes)) {

[*] $questoes_array[$q_enquete] = $aux_questoes[0];

[*] $q_enquete++;

[*] $conta_enquete++;

[*] }

[*]

[*]?>

[*]

[*]<style type="text/css">

[*]<!--

[*]body {

[*] margin-left: 0px;

[*] margin-top: 0px;

[*] margin-right: 0px;

[*] margin-bottom: 0px;

[*]}

[*].style1 {

[*] font-size: 9px;

[*] font-family: Verdana, Arial, Helvetica, sans-serif;

[*] font-weight: bold;

[*]}

[*].style2 {

[*] font-family: Verdana, Arial, Helvetica, sans-serif;

[*] font-size: 12px;

[*]}

[*]-->

[*]</style>

[*]

[*]<form action="java script:abrepagina('insere_voto.php',397,487);" method="get" name="enquete" id="enquete">

[*] <table width="137" border="0" cellspacing="0" cellpadding="1">

[*] <tr>

[*] <td bgcolor="#CCCCCC" class="enquete"><?php echo $data_enquete ." - ". $idenquete[0] ." - ". $idenquete[1]?></td>

[*] </tr>

[*] <tr>

[*] <td bgcolor="#F2F2F2">

[*]<?php

[*] for ($i_enquete=0; $i_enquete<$conta_enquete; $i_enquete++) {

[*]?>

[*] <table width="100%" border="0" cellspacing="0" cellpadding="1">

[*] <tr>

[*] <td height="5" colspan="2"></td>

[*] </tr>

[*] <tr>

[*] <td width="18%" valign="top"><div align="center">

[*] <input name="voto" type="radio" value="<?php echo $votos_array[$i_enquete]; ?>">

[*] </div></td>

[*] <td width="82%"><div align="justify" class="enquete"><?php echo $questoes_array[$i_enquete]?></div></td>

[*] </tr>

[*] <tr>

[*] <td height="5" colspan="2"></td>

[*] </tr>

[*] </table>

[*]<?php

[*] }

[*]?>

[*]<div align="center">

[*] <input type="hidden" name="enquete" value="<?php echo $idenquete[0]; ?>">

[*] <input type="submit" name="Submit" value="enviar" class="butadm">

[*]</div></td>

[*] </tr>

[*] <tr>

[*] <td height="5" bgcolor="#F2F2F2"></td>

[*] </tr>

[*] <tr>

[*] <td height="20" bgcolor="#CCCCCC"><div align="center" class="style1">Ver o resultado... </div></td>

[*] </tr>

[*] <tr>

[*] <td height="20" bgcolor="#CCCCCC"><div align="center" class="style1">Ver demais resultados...</div></td>

[*] </tr>

[*] </table>

[*]</form>

[*]

Compartilhar este post


Link para o post
Compartilhar em outros sites

tipo esse meu codigo eu aproveitei um que o site da emrpesa usa....

Compartilhar este post


Link para o post
Compartilhar em outros sites

wolfphw -> e ai kra beleza?você tem como mostrar a function abrepagina(){} pois no seu codigo ai não mostra essa função por isso que não ta abrindo o popup =Dpoista ai a function abrepagina() beleza para vermos onde ta o erro pois pelo que eu vi no seu codigo ele não abre pq não tem essa function no java script =D

Compartilhar este post


Link para o post
Compartilhar em outros sites

ops mal... eu pensei que tinha colocado ela heheheh

 

 

<script language="javascript"><!-- function abrepagina(page, width, height) {	xposition=0;	yposition=0;	if (width==0) { width = 415; };	if (height==0) { height = 290; };	if (parseInt(navigator.appVersion) >= 4) {  xposition = (screen.width - width) / 2;  yposition = (screen.height - height) / 2;  yposition = yposition - 20;	}	args = "width=" + width + ", height=" + height + ", location=0, menubar=0, " +  "resizable=0, scrollbars=1, status=0, titlebar=0, " +  "toolbar=0, hotkeys=0, screenx=" + xposition + ", screeny=" +  yposition + ", left=" + xposition + ", top=" + yposition;	window.open(page, "janelanova", args);}// --></script>

Compartilhar este post


Link para o post
Compartilhar em outros sites

E ai alguma resposta???

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.