惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Securelist
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
SegmentFault 最新的问题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
Kaspersky official blog
WordPress大学
WordPress大学
I
Intezer
L
Lohrmann on Cybersecurity
V
Vulnerabilities – Threatpost
C
Check Point Blog
A
About on SuperTechFans
AWS News Blog
AWS News Blog
Latest news
Latest news
宝玉的分享
宝玉的分享
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cyber Attacks, Cyber Crime and Cyber Security
SecWiki News
SecWiki News
Recorded Future
Recorded Future
Last Week in AI
Last Week in AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Register - Security
The Register - Security
A
Arctic Wolf
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
V
V2EX
Scott Helme
Scott Helme
I
InfoQ
Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
Recent Announcements
Recent Announcements
Spread Privacy
Spread Privacy
Attack and Defense Labs
Attack and Defense Labs
大猫的无限游戏
大猫的无限游戏
Webroot Blog
Webroot Blog
N
News and Events Feed by Topic
博客园 - 司徒正美
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
NISL@THU
NISL@THU
L
LangChain Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

博客园 - 新传

新空间用fify.cn 努力目标:web UI 工程师!!! [原+转]CSS hack 小技巧 让你的CSS 兼容ff ie6.0 ie7.0 [转]CSS编程提醒及小技巧整理 博文阅读密码验证 - 博客园 [转]一些prototype的实例 [复]一段页面全屏最大化代码 web测试用例[样稿].doc [原]从新浪提取出来的alert、confirm提示效果 b/s系统中自用calender控件 用CSS做的几个漂亮的小按纽 一款很小巧的桌面窗口隐藏工具 我的大学同学 今晚7点半刘德华2007 Wonderful World南京演唱会 [笑话]假新版人民币15元! [原]几种流行php编辑器对utf-8编码 bom问题的处理比较 php 常用函数手册[doc版] 告别了pocketPc 我回到了原点 汗!原来我也上过媒体
[原]thinkphp实例下载 ajax自动完成
新传 · 2007-09-08 · via 博客园 - 新传

IndexAction代码:

class IndexAction extends Action
{
    
function Index()
    {
        
$this->display();
    }
    
    
function ajaxauto(){//自动完成action
        $tagname=$_POST['tagname'];
        
$dao=D('tpltags');
        
$r=$dao->findAll("tagname like '%$tagname%'"); 
        
$this->assign('list',$r);
        
$this->display();
        
    }
    
function showresult(){//显示结果action
        $tagname=$_POST['tagname'];
        
$dao=D('tpltags');
        
$r=$dao->findAll("tagname like '%$tagname%'");
        
$this->assign('list',$r);
        
$this->display();
        
    }
}

首页模板核心:

<tagLib name='cx,html' />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html:link type='css' href='../Public/css/autocomplete.css' />
<html:link type='js' href='../Public/js/prototype.js' />
<html:link type='js' href='../Public/js/effects.js' />
<html:link type='js' href='../Public/js/controls.js' />
<!-- 上面三个js加载顺序为prototype effects controls 不能乱-->
<SCRIPT LANGUAGE="JavaScript">
<!--
// 

window.onload 
= function ()
{
    
new Ajax.Autocompleter("tagname","autocomplete""__URL__/ajaxauto"{});
    
}



function showResults(){
    
    
new Ajax.Updater('description', '__URL__/showresult', {method:'post', postBody:'tagname='+$F('tagname')});
    
new Effect.Appear('description');
    
}


//-->
</SCRIPT>

下载地址:
/Files/webeasy/autosearch.rar (仅app 不含框架 框架请到thinkphp.cn下载)