智能提示的百度搜索框 —— 新:JS压缩更精简

490阅读 0评论2009-07-07 路_人_
分类:

 带智能提示的

  

  


html>
  
  
    content-Type content="text/html;charset=gb2312">
    百度搜索框,带智能提示

  
  

 

  ----把下面的代码放到需要的地方

  


com/s>
----把上面的代码放到需要的地方

  

  ----把下面的代码放到文件末尾

  

<script>
 var w = document.f.wd;
 function s(o) {
  if (w.value.length > 0) {
 var h = o.href;
 var q = encodeURIComponent(w.value);
 if (h.indexOf("q=") != -1) {
  o.href = h.replace(new RegExp("q=[^&$]*"), "q=" + q)
 } else {
  o.href += "?q=" + q
 }
  }
 }; (function() {
  if (new RegExp("q=([^&]+)").test(location.search)) {
 w.value = decodeURIComponent(RegExp.$1)
  }
 })();
  document.write('')
 window.onunload = function() {};
 
 

上一篇:更好的Applet体验:如何使用屏幕截图和海报帧
下一篇:Flex与Java EE深度结合(一)