Jump to content
Fórum Script Brasil
  • 0

Sistemas De Notas


Guest --Victor --

Question

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 to comment
Share on other sites

3 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.6k
×
×
  • Create New...