• 原装即点既改


    //原装即点既改

    //链接数据库
    <?php
    header('Content-type:text/html;Charset=utf8');
    $link=mysqli_connect("localhost:3306","root","root","Zhou");
    if(!$link) echo "连接失败的原因是:" . mysqli_connect_error();
    mysqli_query($link,"set names utf8");
    $sql="select * from yue";
    $a=mysqli_query($link,$sql);
    while($res=mysqli_fetch_assoc($a)){
       $arr[]=$res;
    }
    
    
    ?>
     

    //表单

    <!DOCTYPE html>
    <html lang="en">
    <head>
       <meta charset="UTF-8">
       <title>Document</title>
    </head>
    <body>
       <center>
          <table border="1">
             <tr>
                <td><input type="checkbox" name="box"></td>
                <td>版位编号</td>
                <td>版位名称</td>
                <td>版位类型</td>
                <td>版位尺寸</td>
                <td>广告数</td>
                <td>版位描述</td>        
             </tr>
             <?php foreach($arr as $k => $v) {?>
             <tr>
                <td><input type="checkbox" name="box" value="<?php echo $v['uId']?>"></td>
                <td ondblclick="fundian1(this,2,<?php echo $v['uId']?>)"><?php echo $v['uId']?></td>
                <td ondblclick="fundian(this,1,<?php echo $v['uId']?>)"><?php echo $v['uName']?></td>
                <td ondblclick="fundian2(this,3,<?php echo $v['uId']?>)"><?php echo $v['uLei']?></td>
                <td ondblclick="fundian4(this,4,<?php echo $v['uId']?>)"><?php echo $v['uChi']?></td>
                <td ondblclick="fundian5(this,5,<?php echo $v['uId']?>)"><?php echo $v['uGao']?></td>
                <td><?php echo $v['uMiao']?></td>
             </tr>
             <?php }?>
           
          </table>
    
       </center>
    <!DOCTYPE html>
    <html lang="en">
    <head>
       <meta charset="UTF-8">
       <title>Document</title>
    </head>
    <body>
       <center>
          <table border="1">
             <tr>
                <td><input type="checkbox" name="box"></td>
                <td>版位编号</td>
                <td>版位名称</td>
                <td>版位类型</td>
                <td>版位尺寸</td>
                <td>广告数</td>
                <td>版位描述</td>        
             </tr>
             <?php foreach($arr as $k => $v) {?>
             <tr>
                <td><input type="checkbox" name="box" value="<?php echo $v['uId']?>"></td>
                <td ondblclick="fundian1(this,2,<?php echo $v['uId']?>)"><?php echo $v['uId']?></td>
                <td ondblclick="fundian(this,1,<?php echo $v['uId']?>)"><?php echo $v['uName']?></td>
                <td ondblclick="fundian2(this,3,<?php echo $v['uId']?>)"><?php echo $v['uLei']?></td>
                <td ondblclick="fundian4(this,4,<?php echo $v['uId']?>)"><?php echo $v['uChi']?></td>
                <td ondblclick="fundian5(this,5,<?php echo $v['uId']?>)"><?php echo $v['uGao']?></td>
                <td><?php echo $v['uMiao']?></td>
             </tr>
             <?php }?>
           
          </table>
    
       </center>

    //js.ajax
    <script type="text/javascript">
    //内容
      function fundian(td1,names,idd1){
          var neirong=td1.innerHTML;
          td1.innerHTML="<input type='text' value='"+neirong+"' id='diangai1' onblur='fungai1("+names+","+idd1+")'>";
      }
    function fungai1(aa,bb){
       var diangei1=document.getElementById('diangai1');
       ajax1=new XMLHttpRequest();
       ajax1.onreadystatechange = function (){
          if(ajax1.readyState==4 && ajax1.status==200){
                 var res=ajax1.responseText;
                 diangai1.parentNode.innerHTML=res;
          }
       }
       ajax1.open('GET','./gai.php?names='+aa+'&idd1='+bb+'&diangai1='+diangai1.value,true);
       ajax1.send();
    }
    
    
    //id
    function fundian1(td2,names2,idd2){
          var neirong=td2.innerHTML;
          td2.innerHTML="<input type='text' value='"+neirong+"' id='diangai2' onblur='fungai1("+names2+","+idd2+")'>";
      }
    function fungai1(aa,bb){
       var diangei2=document.getElementById('diangai2');
       ajax1=new XMLHttpRequest();
       ajax1.onreadystatechange = function (){
          if(ajax1.readyState==4 && ajax1.status==200){
                 var res=ajax1.responseText;
                 diangai2.parentNode.innerHTML=res;
          }
       }
       ajax1.open('GET','./gai.php?names='+aa+'&idd2='+bb+'&diangai2='+diangai2.value,true);
       ajax1.send();
    }
    //类型
       function fundian2(td3,names3,idd3){
           var neirong=td3.innerHTML;
           td3.innerHTML="<input type='text' value='"+neirong+"' id='diangai3' onblur='fungai3("+names3+","+idd3+")'>";
       }
    
       function fungai3(aa,bb){
          var diangai3=document.getElementById('diangai3');
          var ajax1=new XMLHttpRequest();
          ajax1.onreadystatechange = function (){
               if(ajax1.readyState==4 && ajax1.status==200){
                    var res=ajax1.responseText;
                   diangai3.parentNode.innerHTML=res;
               }
          }
          ajax1.open('GET','./gai.php?names='+aa+'&idd3='+bb+'&diangai3='+diangai3.value,true);
          ajax1.send();
       }
    
       //尺寸
       function fundian4(td4,name4,idd4){
             var neirong=td4.innerHTML;
             td4.innerHTML="<input type='text' value='"+neirong+"' id='diangai4' onblur='fungai4("+name4+","+idd4+")'>";
    
       }
       function fungai4(aa,bb){
             var diangai4=document.getElementById('diangai4');
             var ajax1=new XMLHttpRequest();
             ajax1.onreadystatechange = function (){
               if(ajax1.readyState==4 && ajax1.status==200){
                  var res=ajax1.responseText;
                  diangai4.parentNode.innerHTML=res;
               }
             }
             ajax1.open('GET','./gai.php?names='+aa+'&idd4='+bb+'&diangai4='+diangai4.value,true);
             ajax1.send();        
       }
    
       //数量
       function fundian5(td5,names5,idd5){
             var neirong=td5.innerHTML;
             td5.innerHTML="<input type='text' id='diangai5' value='"+neirong+"' onblur='fungai5("+names5+","+idd5+")'>";
       }
       function fungai5(aa,bb){
          var diangai5=document.getElementById('diangai5');
          ajax1=new XMLHttpRequest();
          ajax1.onreadystatechange = function (){
             if(ajax1.readyState==4 && ajax1.status==200){
                var res=ajax1.responseText;
                diangai5.parentNode.innerHTML=res;
             }
          }
          ajax1.open('GET','./gai.php?names='+aa+'&idd5='+bb+'&diangai5='+diangai5.value,true);
          ajax1.send();
       }
    </script>
    </body>
    </html>
    
    //gai.php
    <?php
    header('Content-type:text/html;Charset=utf8');
    $link=mysqli_connect("localhost:3306","root","root","Zhou");
    if(!$link) echo "连接失败的原因是:" . mysqli_connect_error();
    mysqli_query($link,"set names utf8");
    $aa=$_GET['names'];
    if($aa==1){
       
       $idd1=$_GET['idd1'];
       $diangai1=$_GET['diangai1'];
       $sql="update yue set uName='$diangai1' where uId='$idd1'";
       $a=mysqli_query($link,$sql);
       if($a){
          echo $diangai1;
       }
    }
    
    if($aa==2){
    
       $idd2=$_GET['idd2'];
       $diangai2=$_GET['diangai2'];
       $sql="update yue set uId='$diangai2' where uId='$idd2'";
       $a=mysqli_query($link,$sql);
       if($a){
          echo $diangai2;
       }
    }
    
    
    if($aa==3){
    
       $idd3=$_GET['idd3'];
       $diangai3=$_GET['diangai3'];
       $sql="update yue set uLei='$diangai3' where uId='$idd3'";
       $a=mysqli_query($link,$sql);
       if($a){
          echo $diangai3;
       }
    }
    
    if($aa==4){
       $idd4=$_GET['idd4'];
       $diangai4=$_GET['diangai4'];
       $sql="update yue set uChi='$diangai4' where uId='$idd4'";
       $a=mysqli_query($link,$sql);
       if($a){
          echo $diangai4;
       }
    }
    if($aa==5){
       $idd5=$_GET['idd5'];
       $diangai5=$_GET['diangai5'];
       $sql="update yue set uGao='$diangai5' where uId='$idd5'";
       $a=mysqli_query($link,$sql);
       if($a){
          echo $diangai5;
       }
    }
    ?>





  • 相关阅读:
    jquery图片播放弹出插件Fancybox
    D3js-API介绍【英】
    ZOJ 3156 Taxi (二分匹配+二分查找)
    linux权限之su和sudo的差别
    CareerCup之1.6 Rotate Image
    [oracle]pl/sql --分页过程demo
    已迁移到http://www.coffin5257.com
    C# 之 集合ArrayList
    Java 序列化Serializable具体解释(附具体样例)
    Android 短信验证码控件
  • 原文地址:https://www.cnblogs.com/chaihtml/p/9376231.html
Copyright © 2020-2023  润新知