Foros del Web » Programando para Internet » Jquery »

*Codigo no funciona que esta mal.*

Estas en el tema de *Codigo no funciona que esta mal.* en el foro de Jquery en Foros del Web. Hola gente de forodelweb quisiera que me ayuden en este codigo el codigo se trata de que el usuario al dar click en un boton ...
  #1 (permalink)  
Antiguo 13/01/2015, 15:18
 
Fecha de Ingreso: enero-2015
Mensajes: 13
Antigüedad: 9 años, 3 meses
Puntos: 0
Exclamación *Codigo no funciona que esta mal.*

Hola gente de forodelweb quisiera que me ayuden en este codigo el codigo se trata de que el usuario al dar click en un boton comienze un conteo de unos 40s y se abra una pestaña durante ese tiempo y luego cambie automaticamente y se acredite 1 punto a earnings,despues vuelva a cargar otra pagina y asi susecivamente, la cosa es que puedo avanzar a hacer abrir la pagina tambien que asome los puntos que tengo pero me falta el contador y q cuando el contador llegue a cero se acredite el 1 punto a earnings GRACIA,conozco una pagina con el mismo codigo y le funciona ayuda
<script type="text/javascript">
var earnings = <?php echo $row_Usuarios['earnings']; ?>;
var currentUrl = null;
var urls = new Array();
var adids = new Array();
var timer = 49;
var currentWindow;
$(document).ready(function()
{
$("#viewad").button({ icons: { primary: "ui-icon-play" } }).hide();
$('#earnings').html('$'+roundNumber(earnings,6));
$('#earnings').hide();
$('#start-surfing').bind('click', function()
{

$("#dialog-message").dialog({
modal: true,
width: 700,
title: 'Surf Ads',
resizable: false,
draggable: false
});

$("#viewad").show();
});


$("#viewad").bind('click',function() {
$('#earnings').show();
$("#viewad").hide();
// we have to open it here on the click event to protect against b10ck3r in ch0r0me...
currentWindow = window.open('youtube_auto_credit.php?start=y&sid=& sid2=&siduid=0', 'videoad', ',type=fullWindow,fullscreen,scrollbars=yes', false);
window.blur();
window.focus();
nextUrl();
});
});
function isWindowClosed()
{
if (!currentWindow || typeof currentWindow == 'undefined' || currentWindow && currentWindow.closed)
{
return true;
}
else
{
return false;
}
}
function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}
function increaseEarnings()
{
earnings = earnings + 1;
$('#earnings').html('$'+roundNumber(earnings,6));
}

Object.size = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};

function nextUrl()
{
$.get("youtube_auto_credit.php" + '?next=go&sid=&sid2=&siduid=0',function(data){
timer = Math.round(data.timer/10);
$('#timer').html(timer);
if(data.status == 'MAX_CLICKS')
{
doneSurfing();
}
else if(data.status == 'TOO_FAST')
{
alert('You are surfing too fast!');
}
else if(data.status == 'LOGIN')
{
alert('You are not logged in');
}
else
{

//alert(data.url);
//if(typeof data.url=='undefined')
//{
//alert('Sorry, the server is having issues, please try again later by refreshing this page.');
//}
//else
//{
if(isWindowClosed())
{
currentWindow = window.open(data.url, 'videoad', ',type=fullWindow,fullscreen,scrollbars=yes', false);
window.blur();
window.focus();
}
else
{
currentWindow.location = data.url;
increaseEarnings();
}
setTimeout(function() { progresscount(timer) }, 1000);
//}
}

},'json');
}
function doneSurfing()
{
url = 'youtube_auto_credit.php?done=y&sid=&sid2=&siduid= 0';
currentWindow.location = url;
}
function progresscount(time)
{
if(time == 0)
{
if(isWindowClosed() == true)
{
$("#dialog-message").dialog('close');
}
else
{
nextUrl();
}
}
else
{
time--;
$('#timer').html(time);
setTimeout(function() { progresscount(time) }, 1000);
}
}

</script>
<script type="text/javascript">

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:45.