小知识总结

 

知识点:

   1)table居中:margin:auto auto;
  
   2)table:
     border-collapse:属性设置表格的边框是否被合并为一个单一的边框
                     separate 默认值。边框会被分开
                     collapse 如果可能,边框会合并为一个单一的边框 

   3)border:#999(颜色) 1px(像素) solid实线  dashed虚线
    任何标签都可以  例如:table tr td div 等

   4)submit 和action使用
 
   5)放跳墙技术:登录成功$_SESSION['loginFlag']=1;
     在每个页面引入 checkUser.php
        <?php
           session_start();
          //防跳墙技术
          //判断session中是否有值
         if(!$_SESSION['loginFlag']){
        header("location:index.php");
      }
        ?>

   6)<连接>调用函数
  <a href="javascript:void(0)" onclick="cancelShield()">取消屏蔽</a>
  javascript:void(0)不会执行什么
  onclick="cancelShield()";调用函数

  7)select重点:
   
      <select id="onlineUser" size="20" style="width:100px;">
      </select>

       size是高度  width:是高度   适合列表显示
 
    js添加option:
 
    ①var sel=document.getElementById("onlineUser");
                           获取select中id的值
    ②sel.options.length=0;  
                           清空上次查询的在线用户
    ③for(var m=0;m<users.length;m++){
        var op=new Option(users[m].username+"|"+users

[m].theip,users[m].id);                    
           }  
         Option(显示的内容,select的id); 
              
    ④sel.options.add(op);
                         把option添加到select中
 


   8)在线文本编辑器总结:可以见chat-index.php

<?php

  //引用FCKeditor.php这个文件,基本的类和数据结构都在这里
   include ("fckeditor/fckeditor.php");

//创建FCKeditor对象的实例。myFCKeditor即提交后,接收数据页面 POST

['content']使用
$FCKeditor = new FCKeditor("sendMsg");

//FCKeditor所在的位置,这里它的位置就是'FCKeditor' 文件夹
$FCKeditor -> BasePath='./fckeditor/';

//工具按钮设置
$FCKeditor -> ToolbarSet="Basic";

//设置它的宽度
$FCKeditor -> Width='500px';

//设置它的高度
$FCKeditor -> Height='150px';

//生成
$FCKeditor -> Create();

?>


  javascript中:

  获取编辑器的值:

    ①获取多文本编辑器的对象  (内定的函数)
        var oEditor=FCKeditorAPI.GetInstance('sendMsg');

    ②获取用户输入的内容
        var acontent=oEditor.GetXHTML();

    ③可以过滤掉自动带着的<p></p>标记
        acontent=acontent.substr(3,acontent.length-7);

  使编辑器中的内容为空:
   
    ①var oEditor=FCKeditorAPI.GetInstance("sendMsg");
   
    ②oEditor.SetHTML(""); 使内容为空


  9)收集textarea的值
     <form name="myform" method="post">
       <textarea id="sendMsg" name="sendMsg"cols="59"rows="3">
       </textarea>
    </form>

     var value=document.getElementById("sendMsg").value;

    ①ajax发送致php值
        var params="&nr="+encodeURI(acontent);

    ②通过post发送到php

        var value=$_POST['sendMsg'];

  10)php转换为json格式

     php中:
<?php
    $arr2=array();
    $arrMsg=array();
    $arrusers=array();
       while($rows=mysql_fetch_assoc($rs)){
  
   $arrMsg[]=$rows;
   }
  
     $arr2=array("Users"=>$arrusers,"Msgs"=>$arrMsg,"sq"=>$sqq); 

 
      echo json_encode($arr2);
 ?> 
  
   javascript中:

     v ar obj=eval("("+xhr.responseText+")");
   //所有的聊天信息
   var rows=obj.Msgs;
   //取出所有的用户信息
   var users=obj.Users;
      //循环遍历取得php值
       for(var m=0;m<users.length;m++){
    
  var op=new Option(users[m].username+"|"+users             

                         [m].theip,users[m].id);
 sel.options.add(op);
     }


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值