日期:2014-05-16  浏览次数:20708 次

就表简单的问题

<script type="text/javascript">

        $(function() {
           var index = [
                  
                { name: "0001", to: "peter@pan.de" },
{ name: "0002", to: "aaa@pan.de" },
                
                ];
                       
             $('#content').autocomplete(index,
             {
                width :400,                
                minLength: 2,
                formatItem: function (row, i, max)
                {   
                    return "<table><tr><td align='left'>" + row.name + "</td></tr></table>";
                 },
                formatMatch: function(row, i, max)
                { 
                     return row.name;
                     
                } ,

                
             });
             
            }); 
      
     </script>

比如我输入000,autocomplete插件提示有0001和0002,我选择0001后,会转到WWW.AAAA.COM/INDEX/ID/0001.原来的信息保存转到这个URL。也就是自动完成后刷新到现在的URL后面加上/id/0001原有信息保留
当点击提示自动完成后向url后添加一个id=0001刷新页新。但选择的数据还是