Google suggest;-) _javascript technique of dynamic Pull-down menu based on JS

Source: Internet
Author: User
Tags visibility
The basic principle is to create an iframe in the current window, and then place a list of related keywords in the IFRAME and place the selected item in the Search box through the list selection.
It seems that all the hints have been searched and recorded in advance so quickly that all the relevant keywords can be retrieved. Try "Sex", there is no relevant search tips, it seems to have a rigorous search term pornographic filtering.
In addition: This dynamic list function is also used in Gmail's address bar automatic input complete, as shown:
Google automatically completed the following source code:
Copyright and onwards Google Inc.
var w= "";
var Pa=false;
var ta= "";
var Da=false;
var g= "";
var g= "";
var m= "";
var j=-1;
var h=null;
var z=-1;
var za=null;
var ca=5;
var q= "";
var lb= "Div";
var bb= "span";
var la=null;
var a=null;
var b=null;
var xa=null;
var mb=null;
var x=null;
var ha=null;
var Ra=false;
var kc=null;
var hc=null;
var ua=new Object ();
var ca=1;
var aa=1;
var Y=false;
var na=-1;
var va= (new Date ()). GetTime ();
var Q=false;
var k=null;
var sa=null;
var e=null;
var b=null;
var aa=null;
var Ba=false;
var Ka=false;
var p=60;
var ia=null;
var ya=null;
var w=0;
Installac=function (FRM,FLD,SB,PN,RL,HD,SM,UFN) {la=frm; a=fld;
XA=SB;
if (!PN) pn= "search";
IA=PN;
var kb= "en|";
var jb= "zh-cn|zh-tw|ja|ko|vi|"; if (!rl| | Kb.indexof (rl+ "|")
==-1) rl= "en";
HA=NB (RL); if (Jb.indexof (ha+ "|")
==-1) {x=true;
Y=false;
Ba=false} else{X=false if (ha.indexof ("en") ==0) y=false; else y=true;
Ba=true} if (!HD) Hd=false;
YA=HD;
if (!SM) sm= "Query";
W=SM;
MB=UFN;
AC ()}; function Yb () {ra=true; a.blur ();
SetTimeout ("SFI ();", 10); return} function Fb () {if (document.createeventobject) {var y=document.createeventobject (); Y.ctrlkey=true y.keycode=
70; Document.fireevent ("onkeydown", Y)}} function NC (VB) {var y=document.createeventobject (); y.ctrlkey=true; y.keycode=
vb Document.fireevent ("onkeydown", y)} function gc (event) {} function IC (event) {} function Pb (event) {if!event&&w
indow.event) event=window.event;
if (event) Na=event.keycode; if (event&&event.keycode==8) {if x&& (a.createtextrange&& event.srcelement==a&& ( BB (a) ==0&&lb (a) ==0))) {cc (a); event.cancelbubble=true; event.returnvalue=false; return false}}} function MC ( {} function Db () {if (w== "url") {Ha ()} BA ()} function Ba () {if (b) {B.style.left=ob (a) + "px"; b.style.top=qb (a) +a.offseth
eight-1+ "px"; B.style.width=ja () + "px"}} function Ja () {if (Navigator&&navigator.useragent.tolowercase (). IndexOf ("msie") =
=-1) {return a.offsetwidth-ca*2} else{return a.offsetwidth}}
function ac () {if (JB ()) {q=true} else{Q=false} if (PA) e= "complete"; else e= "/complete/" +ia; sa=e+ "? hl=" +HA; if (!
Q) {QA ("Qu", "" ", 0,e,null,null)} La.onsubmit=fa;
A.autocomplete= "Off";
A.onblur=ob;
 if (a.createtextrange) a.onkeyup=new Function ("Return Okuh" (event);
");
else A.onkeyup=okuh;
A.ONSUBMIT=FA;
G=a.value;
ta=g;
B=document.createelement ("DIV");
B.id= "Completediv";
Ca=1;
Aa=1;
B.style.borderright= "Black" +ca+ "px solid";
B.style.borderleft= "Black" +ca+ "px solid";
B.style.bordertop= "Black" +aa+ "px solid";
B.style.borderbottom= "Black" +aa+ "px solid";
b.style.zindex= "1";
b.style.paddingright= "0";
b.style.paddingleft= "0";
b.style.paddingtop= "0";
b.style.paddingbottom= "0";
BA ();
B.style.visibility= "hidden";
b.style.position= "Absolute";
b.style.backgroundcolor= "White";
Document.body.appendChild (b);
Ma ("", New Array (), new Array ());
Gb (b);
var s=document.createelement ("DIV");
S.style.visibility= "hidden";
s.style.position= "Absolute";
S.style.left= "-10000";
S.style.top= "-10000"; S.style.width= "0 ";
s.style.height= "0";
var m=document.createelement ("IFRAME");
M.completediv=b;
M.name= "Completionframe";
M.id= "Completionframe";
M.src=sa;
S.appendchild (M);
Document.body.appendChild (s); if (frames&& (frames["Completionframe"]&&frames["Completionframe"].frameelement)) B=frames["
Completionframe "].frameelement;
else B=document.getelementbyid ("Completionframe");
if (w== "url") {Ha (); BA ()} window.onresize=db;
DOCUMENT.ONKEYDOWN=PB; Fb ()} function Ob (event) {if (!event&&window.event) event=window.event; if (!ra) {F (); if (na==9) {Xb (); Na=-1}} RA
=false} okuh=function (e) {m=e.keycode; aa=a.value;
Oa ()};
function Xb () {Xa.focus ()} sfi=function () {a.focus ()}; function Wb {for (var f=0,oa= "", zb= "\n\r"; F function Qa (I,DC) {var ga=i.getelementsbytagname (Bb); if (GA) {for (Var f=0
; f function U (i) {if (!i) return null; return QA (i, "cautocomplete")} function wa (i) {if (!i) return null; return QA (i, "Dautoco Mplete ")} function F () {document.getElementById (" Completediv "). Style. visibility= "Hidden"} function cb () {document.getElementById ("Completediv"). style.visibility= "visible"; BA ()} function Ma (is,cs,ds) {ua[is]=new Array (cs,ds)} sendrpcdone=function (FR,IS,CS,DS,PR) {if (w>0) w--; var lc= (New Date (
)). GetTime ();
if (!FR) fr=b;
Ma (IS,CS,DS);
var B=fr.completediv;
B.completestrings=cs;
B.displaystrings=ds;
B.PREFIXSTRINGS=PR;
RB (B,b.completestrings,b.displaystrings);
Pa (B,u);
if (ca>0) b.height=16*ca+4;
Else F ()}; function Oa () {if (m==40| |
m==38) Yb ();
var n=lb (a);
var v=bb (a);
var V=a.value; if (x&&m!=0) {if (n>0&&v!=-1) v=v.substring (0,v); if (m==13| | m==3) {var d=a; if (d.createtextrange) {var t=d.createtextrange (); T.movestart ("character", d.value.length); T.select ()
else if (d.setselectionrange) {D.setselectionrange (d.value.length,d.value.length)}} else{if (a.value!=v) S (V)} G=V; if (EB (m) &&m!=0) Pa (b,u)} function Fa () {return XB (W)} function xb (EB) {da=true; if (!)
Q) {QA ("Qu", "" ", 0,e,null,null)} F (); if (eb== "url") {var r= ""; if (j!=-1&&H) R=u (h);
if (r== "") R=a.value;
if (q== "") document.title=r;
else document.title=q;
var tb= "window.frames['" +mb+ "'].location = '" +r+ ' ";
';
SetTimeout (tb,10);
return false} else if (eb== "query") {La.submit (), Return True}} newwin=function () {window.open (a.value);
F ();
return false};
Idkc=function (e) {if (Ba) {var ta=a.value; if (TA!=AA) {m=0;
Oa ()} Aa=ta;
SetTimeout ("IDKC ()", 10)}};
SetTimeout ("IDKC ()", 10);
function nb (LA) {if (encodeuricomponent) return encodeURIComponent (LA), if (escape) return Escape (LA)} function YB (Mb) {
var h=100;
for (Var o=1 o<= (Mb-2)/2; o++) {h=h*2} h=h+50; Return H} idfn=function () {if (ta!=g) {if (!da) {var za=nb (g); var ma=ua[g]; if (MA) {va=-1; Sendrpcdone (B,G,MA[0],MA[1],B.C
ompletediv.prefixstrings)} else{w++;
Va= (New Date ()). GetTime ();
if (Q) {FC (Za)} else{QA ("Qu", za,null,e,null,null); frames["Completionframe"].document.location.reload (True)}
A.focus ()} da=false} ta=g;
SetTimeout ("IDFN ()", YB (W));
return true};
SetTimeout ("IDFN ()", 10); var Cb=function () {S (U)); Q=wa (this); da=true;
Fa ()};
var pb=function () {if (h) L (H, "aautocomplete"); L (This, "Bautocomplete")};
var ec=function () {L (this, "Aautocomplete")};
function Na (C) {g=g;
S (G);
q=g; if (!za| |
z<=0) return;
CB ();
if (c>=z) {c=z-1} if (j!=-1&&c!=j) {L (h, aautocomplete); J=-1} if (c<0) {j=-1; A.focus (); return} j=c;
H=za.item (C);
L (H, "bautocomplete");
g=g;
Q=wa (h); S (U (h))} function Eb (ja) {if (ja==40) {na (j+1); return false} else if (ja==38) {Na (j-1); return false} else if (ja==13| | Ja==3) {return false} return true} function Pa (K,ib) {var d=a; var t=false; j=-1; var j=k.getelementsbytagname (Lb); var O
=j.length;
Z=o;
Za=j;
Ca=o;
g=g; if (g== "" | |
o==0) {F ()} else{CB ()} var ab= ""; if (g.length>0) {var f; var o; for (Var f=0. f function ob (r) {return ya (r, offsetleft)} function Qb (r) {return ya (r, "O Ffsettop ")} function Ya (R,ia) {var kb=0; while (R) {Kb+=r[ia]; R=r.offsetparent} return KB} function QA (NAME,VALUE,RA,HB, FB,SB) {var nb=name+ "=" +value+ (Ra?);
 Expires= "+ra.togmtstring ():" ") + (HB?);
 Path= "+HB:" "+ (FB?");
 domain= "+FB:" "+ (Sb?)";
Secure ":" ");

DOCUMENT.COOKIE=NB} function Ha () {var xa=document.body.scrollwidth-220; xa=0.73*xa; A.size=math.floor (xa/6.18)}
function lb (n) {var n=-1; if (n.createtextrange) {var fa=document.selection.createrange (). duplicate (); N=fa.text.length} else if (N.setselectionrange) {N=n.selectionend-n.selectionstart} return n} function bb (n) {var v=0; if (N.createtextrange)
{var fa=document.selection.createrange (). duplicate (); Fa.moveend ("TextEdit", 1); V=n.value.length-fa.text.length} else if (n.setselectionrange) {V=n.selectionstart} else{V=-1} return v} function cc (d) {if (D.createtextrange) {var t=d.cr
Eatetextrange ();
T.movestart ("character", d.value.length);
T.select ()} else if (D.setselectionrange) {D.setselectionrange (d.value.length,d.value.length)}} function JC (Zb,Ea) { if (!
Ea) ea=1;
if (Pa&&pa<=ea) {var ia=document.createelement ("DIV");
IA.INNERHTML=ZB; document.getElementById ("console"). APpendchild (Ia)}} function L (c,name) {db (); c.classname=name; if (Ka) {return} switch (Name.charat (0)) {case "M": c.style.f
Ontsize= "13px";
C.style.fontfamily= "Arial,sans-serif";
C.style.wordwrap= "Break-word";
Break
Case "L": c.style.display= "block";
c.style.paddingleft= "3";
c.style.paddingright= "3";
C.style.height= "16px";
C.style.overflow= "hidden";
Break
Case "a": c.style.backgroundcolor= "white";
C.style.color= "BLACK";
if (c.displayspan) {c.displayspan.style.color= "green"} break;
Case "B": c.style.backgroundcolor= "#3366cc";
c.style.color= "White";
if (c.displayspan) {c.displayspan.style.color= ' white '} break;
Case "C": c.style.width=p+ "%";
C.style.cssfloat= "left";
Break
Case "D": The c.style.cssfloat= "right";
c.style.width=100-p+ "%"; if (w== "query") {c.style.fontsize= "10px"; c.style.textalign= "right"; c.style.color= "green"; c.style.paddingtop= "3px "} else{c.style.color=" #696969} Break}} function db () {p=65; if (w== "query") {var wb=110; var sa=ja (); var tb= (SA-WB)/S
a*100; P=TB} else{p=65} if (ya) {
p=99.99}} function Gb (i) {db (); var ub= "FONT-SIZE:13PX;
 Font-family:arial,sans-serif;
Word-wrap:break-word;
";
 var vb= "Display:block;
 Padding-left:3;
 Padding-right:3;
 height:16px;
Overflow:hidden;
";
var bc= "Background-color:white;
";
 var qb= "Background-color: #3366cc; Color:white!
Important
";
 var ub= "Display:block;
 margin-left:0%;
 Width: "+p+"%;
Float:left;
";
 var ga= "Display:block;
Margin-left: "+p+"%;
";
 if (w== "query") {ga+= "font-size:10px;
 Text-align:right;
 Color:green;
padding-top:3px;
"} else{ga+=" color: #696969;
"} D (". Mautocomplete ", Ub);
D (". Lautocomplete", Vb);
D (". Aautocomplete *", BC);
D (". Bautocomplete *", QB);
D (". Cautocomplete", UB);
D (". Dautocomplete", Ga); L (i, "mautocomplete")} function RB (I,CS,HB) {while (i.childnodes.length>0) I.removechild (i.childnodes[0));
f=0;
f function D (NAME,GB) {if (Ka) {var i=document.stylesheets[0]; if (i.addrule) {i.addrule (NAME,GB)} else if (I.insertrule) { I.insertrule (name+ "{" +gb+ "}", I.cssrules.Length)}} function jb () {var a=null; try{a=new ActiveXObject ("Msxml2.xmlhttp")} catch (e) {try{a=new ActiveXObject ("M Icrosoft. XMLHTTP ")} catch (OC) {A=null}} if (! a&&typeof xmlhttprequest!= "undefined") {a=new XMLHttpRequest ()} return A} function FC (Rb) {if (k&&
k.readystate!=0) {k.abort ()} k=jb (); if (k) {K.open ("get", sa+ "&js=true&qu=" +rb,true); K.onreadystatechange=function () {if (k.readystate==4&
&k.responsetext) {var frameelement=b; if (k.responsetext.charat (0) = = "<") {w--} else{eval (K.responsetext)}}};



 K.send (NULL)} function S (Wa) {a.value=wa; Aa=wa}
The source code writes very "crowded", I have to use the following code to do beautifier:perl-pe ' s/;/;\n/g ' ac.js |perl-pe ' s/}/}\n/g ' |perl-pe ' s/{/{\n/g ' > Ac.js.txt Attachment: You have tried to input 26 English letters from the a~z, so what will be the first line of words: a---amazon b---Best Buy c---CNN d---Dictionary e---ebay f---firefox g---games h-- -hotmail I---IKEA j---jokes k---kazaa l---lyrics m---mapquest n---news o---online dictionary p---Paris Hilton q---quotes r ---recipes s---spybot t---tara reid u---UPS v---verizon w---weather x---xbox y---yahoo z---zip codes

Che Dong [1] and huttmean[2] All said the benefits of Google search advice.
[1] http://www.chedong.com/blog/archives/000028.html
[2] Http://www.hutteman.com/weblog/2004/12/10-217.html

Che Dong said better. Back to the code. Worthy of the technical school.

I don't care about this function. : Gmail is still good.
, because you don't have to remember your email address. On
Like using a local email program. Useful in Google
Little.

I'm writing this to ask a question. I'm not technically sending me
It's partners who pie. :)

Not only is there a hint in Google, but also a memory search.
The eye (or this is the browser in memory?) )

1 for privacy reasons I want to disable Google search
What to do with and/or memory. 2) I can't help it. But
Now the machine to replace the use of, how I emptied the search
Cord memory. 3) further. I want Google to think that I
This is using another machine to surf the internet is just delete before
Is the cookie left by Google OK? If it is it
How to find cookies. If not, what should
Do?

Maybe the questions you ask are not the right ones. You probably guess I
What's the question?:)

Not everyone can have a calculation of their own use
Machine. and the public computer (as in the shared office
and the library) This privacy issue will be more prominent.

Gmail has been criticized for privacy issues (of course its
Actually other email service providers are not as good as Gmail. )
Now Google is too powerful, maybe even more than yourself
Know what you've been doing online. You said it would.
, east of the car?

Reply to:
Http://www.chedong.com/blog/archives/000028.html

It may be better to reply to CC mail. Hehe
It's a lot of people's concern not to let Google divulge too much privacy to users.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.