PHP (20140508)

通过Ajax操作Dom:

PHP (20140508)
 1 if(xmlHttp.readyState == 4){
 2             if(xmlHttp.status == 200){
 3                 var sobj = document.getElementById("suggest");
 4                 var str = xmlHttp.responseText.split("-");
 5                 var suggest = "";
 6                 if(str.length >0 && str[0].length > 0){
 7                     for(var i=0; i<str.length; i++){
 8                         suggest += "<div class=‘suggest_link‘ " +
 9                                 " onmouseover=\"this.className=‘suggest_link_over‘\" " +
10                                 " onmouseout=\"this.className=‘suggest_link‘\" >"+str[i]+"</div>"
11                     }
12                     sobj.innerHTML = suggest;
13                     sobj.style.display = "block";
14                 }else{
15                     sobj.style.display = "none";
16                 }
17             }
18         }
PHP (20140508)

把数据库中的数据显示在界面上。

PHP (20140508),布布扣,bubuko.com

PHP (20140508)

上一篇:php 如何判断一个常量是否已经定义


下一篇:(转)HTML5开发学习(2):本地存储之localStorage 、sessionStorage、globalStorage