现有个php页面,页面上有  成绩 65 (23人参与)
                   我也要打分
点击上面的 “我也要打分” 后,要求此页面弹出一个小的页面,小的页面中有 100 80 60 40 这几种分,我选一种,点小页面上的确定,就可把分传到最先的那个页面,这怎么实现呀,多谢,大家贴点代码

解决方案 »

  1.   

    这要用javascript来实现.  php不能这样
      

  2.   

    1.一种是ajax.
    2.javascript弹出窗口,将选择的分数据写入数据库,然后点击确定后,刷新父页面.将分数取出.
      

  3.   

    js的弹窗或者用div的层来模拟,前者比较简单,就是不大好看
      

  4.   


    如果只是簡單的傳遞參數,建議用JS+CSS+DIV彈出窗口操作比較好!
      

  5.   


    <script language="javascript">
    var num = 0;
    function Comment(){
    var score = showModalDialog("./Comment.html?Ran="+Math.random(),"","");
    if(score==undefined){
    return;
    }
    num = num+1;
    document.getElementById("allScore").innerHTML=document.getElementById("allScore").innerHTML+","+score;
    document.getElementById("commentPeople").innerHTML = "总计有"+num+"位评论";
    }
    </script>
    <div id="allScore">
    </div>
    <div id ="commentPeople">
    总计有0位评论
    </div>
    <a href="javascript:void(0);" onclick="Comment();">我也要评分</a>
    Comment.html<script language="javascript">
    function Back(){
    Temp = document.getElementsByName('score');
    for(i=0;i<Temp.length;i++){
    if(Temp[i].checked == true){

    //这里可以加入ajax访问web服务器更新数据库 window.returnValue = Temp[i].value;
    window.close();
    }
    }

    }
    </script>
    <ul>
    <li>
    <input type="radio" name="score" value = "100" checked="checked">100<br>
    </li>
    <li>
    <input type="radio" name="score" value = "80">80<br>
    </li>
    <li>
    <input type="radio" name="score" value = "60">60<br>
    </li>
    <li>
    <input type="radio" name="score" value = "40">40<br>
    </li>
    <ul>
    <input type="button" value="确认" onclick="Back();">这是用模拟窗口来做的,没做样式和优化,如果想要更好的效果可以考虑jquery的Dialog插件
      

  6.   

    用jquery的Dialog插件 怎么实现呀,贴点代码,多谢
      

  7.   

    7楼的
    用jquery的Dialog插件 怎么实现呀,贴点代码,多谢
      

  8.   


    <script src="/inc/NewGlobal/jquery-1.3.2.js"></script>
    <script src="/inc/NewGlobal/jquery-ui-1.7.2.custom.min.js"></script>
    <link type="text/css" href="/inc/NewGlobal/css/redmond/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
    <script language="javascript">
    var num = 0;
    $(function(){
    $('#Commentdialog').dialog({
    autoOpen: false,
    bgiframe: true,
    modal:true,
    title:"评分",
    buttons: {
    "返回": function() { 
    $(this).dialog("close"); 
    },
    "确认": function() {
    num = num+1;
    var Temp = document.getElementsByName('score');
        for(i=0;i<Temp.length;i++){
            if(Temp[i].checked == true){
             var score = Temp[i].value;
             break;
            }
        }
    temp = $('#allScore').text();
    $('#allScore').text(temp+','+score);
    $('#commentPeople').text("总计有"+num+"位评论");
    $(this).dialog("close");
    }
    }
    });
    });
    function Comment(){
    //Commentdialog的数据也可以通过ajax获取到,然后写在里面,再打开
    /*
    $.ajax({
                type:"POST",
                url:"./Comment.php",
                dataType:"html",
    timeout:"3000",
                success:function(data)
                    {
                        $('#Commentdialog').html(data);
                    },
               error:function()
                   {
                        $('#Commentdialog').html('页面打开失败');
                   }
       });
       $('#Commentdialog').html('载入中');
       */
    $('#Commentdialog').dialog('open');
    }</script>
    <div id="allScore">
    </div>
    <div id ="commentPeople">
    总计有0位评论
    </div>
    <a href="javascript:void(0);" onclick="Comment();">我也要评分</a><div id="Commentdialog">
    <ul>
    <li>
    <input type="radio" name="score" value = "100" checked="checked">100<br>
    </li>
    <li>
    <input type="radio" name="score" value = "80">80<br>
    </li>
    <li>
    <input type="radio" name="score" value = "60">60<br>
    </li>
    <li>
    <input type="radio" name="score" value = "40">40<br>
    </li>
    <ul>
    </div>那几个jquery的文件可以去官网上下。
    这里是在一个页面上执行的,要是分值是动态生成的可以考虑用ajax访问,上面的注释里已经写了方法
      

  9.   

    12楼的,我没找到你的那个版本的包,
    我的email  [email protected] 
    请你发给我,多谢