Ir para conteúdo
Fórum Script Brasil
  • 0

Sistemas De Notas


Guest --Victor --

Pergunta

Guest --Victor --

Olá, tenho um sisteminha de dar notas, e gostaria de enviar a variável sMax para um documento .php, para q eu possa inserir no banco de dados.

/*
Author: Addam M. Driver
Date: 10/31/2006
*/

var sMax = 5;    // Is the maximum number of stars
var holder; // Is the holding pattern for clicked state
var preSet; // Is the PreSet value onces a selection has been made
var rated;

// Rollover for image Stars //
function rating(num){
    if(!rated){
        s = num.id; // Get the selected star
        a = 0;
        for(i=1; i<=sMax; i++){        
            if(i<=s){
                document.getElementById(i).style.backgroundImage = "url(star_on.gif)";
                document.getElementById("rateStatus").innerHTML = num.name;    
                holder = a+1;
                a++;
            }else{
                document.getElementById(i).style.backgroundImage = "url(star_off.gif)";
            }
        }
    }
}

// For when you roll out of the the whole thing //
function off(me){
    if(!rated){
        if(!preSet){    
            for(i=1; i<=sMax; i++){        
                document.getElementById(i).style.backgroundImage = "url(star_off.gif)";
                document.getElementById("rateStatus").innerHTML = "Rate Me...";
            }
        }else{
            rating(preSet);
            document.getElementById("rateStatus").innerHTML = "<span style='color:red'>Rating Saved!</span>";
        }
    }
}

// When you actually rate something //
function rateIt(me){
    if(!rated){
        document.getElementById("rateStatus").innerHTML = "<span style='color:red'>Rating Saved!</span>";
        preSet = me;
        rated=1;
        sendRate(me.id);
        rating(me);
    }
}

// Send the rating information somewhere using Ajax or something like that.
function sendRate(sel){
    document.getElementById("rateStatus").innerHTML = "<span style='color:red'>Rating Saved!</span>";
    
}

Entendo muito pouco de js, ou ajax, como faço para enviar essa variável?

Obrigado

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      652k
×
×
  • Criar Novo...