你好即时通讯从一个JavaScript教程的代码很伟大的工作..它的评级明星系统,所以我可以问我的用户,你的技能的东西,他们可以“回答”利用这种评级制度,....使用json捕获数据使用json在PHP中进行查询
,所以我需要‘追赶’该值。(使用JSON?或者这就是我一直在这里阅读),终于将其插入数据库
我可以将这个值存储在$ _SESSION中吗?..因为这会很好,因为我使用步骤公式,每个步骤在会话中存储变量,所以在最后一步我插入所有使用PHP在MySQL数据库。你会看到数据已准备好发送蜜蜂:D多数民众赞成在伟大的,但是,我怎么捕捉它,并将它存储在$ _SESSION。提前致谢!!
而且我Asume,我可以ASIGN ID或东西从一个页面发送多个率,
这不是在代码中指定,并与JavaScript的即时通讯非常糟糕的其实..(这就是为什么我问所有的智慧人stackoverlflow)
这是从这里http://reignwaterdesigns.com/ad/tidbits/rateme/
/*
Author: Addam M. Driver
Date: 10/31/2006
*/
var sMax; // Isthe 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){
sMax = 0; // Isthe maximum number of stars
for(n=0; n<num.parentNode.childNodes.length; n++){
if(num.parentNode.childNodes[n].nodeName == "A"){
sMax++;
}
}
if(!rated){
s = num.id.replace("_", ''); // Get the selected star
a = 0;
for(i=1; i<=sMax; i++){
if(i<=s){
document.getElementById("_"+i).className = "on";
document.getElementById("rateStatus").innerHTML = num.title;
holder = a+1;
a++;
}else{
document.getElementById("_"+i).className = "";
}
}
}
}
// 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).className = "";
document.getElementById("rateStatus").innerHTML = me.parentNode.title;
}
}else{
rating(preSet);
document.getElementById("rateStatus").innerHTML = document.getElementById("ratingSaved").innerHTML;
}
}
}
// When you actually rate something //
function rateIt(me){
if(!rated){
document.getElementById("rateStatus").innerHTML = document.getElementById("ratingSaved").innerHTML + " :: "+me.title;
preSet = me;
rated=1;
sendRate(me);
rating(me);
}
}
// Send the rating information somewhere using Ajax or something like that.
function sendRate(sel){
alert("Your rating was: "+sel.title);
}
非常感谢,但什么赶在PHP $ _SESSION = {评级方式:sel.title)我知道它不是,我在想念着这部分 – 2013-05-14 04:39:25
的浏览器将向服务器提交POST请求。所以你的php脚本会通过'$ _POST ['rating']'看到输入。要将该值放入会话中:'$ _SESSION ['rating'] = $ _POST ['rating']' – timemachine3030 2013-05-14 04:42:47