Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > how google suggest works -- which event is attached to INPUT element

Reply
Thread Tools

how google suggest works -- which event is attached to INPUT element

 
 
wolverine
Guest
Posts: n/a
 
      09-06-2007
Hi,
Hope every body uses google suggest http://www.google.com/webhp?complete=1&hl=en.
For every key press in the input box google would offer suggestions. I
wanted to see which event is attached to the the INPUT element.

Since the element is inside the form 'f' and it's name is 'q'. So i
accessed it as
javascript:alert(document.f.q.onkeypress) from address bar

The problem is in Mozilla FireFox it is correctly giving me the
handler attached but in IE it was giving me 'null' indicating that
onkeypress is not attached. So i tried with 'onkeydown' and 'onkeyup'
as well. Both of them in IE returned null. So how does IE detect that
a key has been pressed.

So my doubt is a key event attached by google suggest in IE or google
suggest is using some other means to detect that a key event has
happened.

In case a key event is attached in IE, how to verify that it has been
really attached ? Could any one of you help me in this matter .

Thanks in Advance
Kiran.

 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      09-06-2007
Randy Webb wrote:
> View the source.
> [...]
> Why not view the source?
> [...]
> Try viewing the source.....


YMMD


Regards,
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$(E-Mail Removed)>
 
Reply With Quote
 
 
 
 
wolverine
Guest
Posts: n/a
 
      09-07-2007
On Sep 6, 8:25 pm, Randy Webb <(E-Mail Removed)> wrote:
> wolverine said the following on 9/6/2007 9:33 AM:
>
> > Hi,
> > Hope every body uses google suggesthttp://www.google.com/webhp?complete=1&hl=en.

>
> I don't, I find it very annoying.


If every body was the same world would be very boring.

>
> > For every key press in the input box google would offer suggestions. I
> > wanted to see which event is attached to the the INPUT element.

>
> View the source.


I was unable to find it by viewing the source. You are a genius if you
could do that by viewing
source. Prove it if you could understand that by viewing the source

>
> > Since the element is inside the form 'f' and it's name is 'q'. So i
> > accessed it as
> > javascript:alert(document.f.q.onkeypress) from address bar

>
> Why not view the source?


I was unable to find it by viewing the source. You are a genius if you
could do that by viewing
source. Prove it if you could understand that by viewing the source


>
> > In case a key event is attached in IE, how to verify that it has been
> > really attached ? Could any one of you help me in this matter .

>
> Try viewing the source.....


I was unable to find it by viewing the source. You are a genius if you
could do that by viewing
source. Prove it if you could understand that by viewing the source



>
> --
> Randy
> Chance Favors The Prepared Mind
> comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
> Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/



 
Reply With Quote
 
marss
Guest
Posts: n/a
 
      09-07-2007
On 6 , 18:25, Randy Webb <(E-Mail Removed)> wrote:

> View the source.
> [...]
> Why not view the source?
> [...]
> Try viewing the source.....


A good answer as for a person who is somewhat of an expert/moderator.
Keep it up that way, you make this newsgroup very cognitive.

 
Reply With Quote
 
marss
Guest
Posts: n/a
 
      09-07-2007
On 6 , 16:33, wolverine <(E-Mail Removed)> wrote:

> javascript:alert(document.f.q.onkeypress) from address bar


You can see a function attached to an event only if it set directly:
e.g.
q.onkeypress = someFuntion;
or
<input onkeypress="someFuntion()" ...

You can't see event handlers that are attached by attachEvent or
addEventListener

Regards,
Mykola
http://marss.co.ua

 
Reply With Quote
 
wolverine
Guest
Posts: n/a
 
      09-07-2007
On Sep 7, 1:30 pm, marss <(E-Mail Removed)> wrote:
> On 6 , 16:33, wolverine <(E-Mail Removed)> wrote:
>
> > javascript:alert(document.f.q.onkeypress) from address bar

>
> You can see a function attached to an event only if it set directly:
> e.g.
> q.onkeypress = someFuntion;
> or
> <input onkeypress="someFuntion()" ...
>
> You can't see event handlers that are attached by attachEvent or
> addEventListener
>


You got it. That is what i meant.

Even before posting the question i viewed the source and was not able
to find any of the first 2 ways you suggested. Actually my question
was how to find events added addEventListener in IE?


> Regards,
> Mykolahttp://marss.co.ua



 
Reply With Quote
 
marss
Guest
Posts: n/a
 
      09-07-2007
On 7 , 12:10, wolverine <(E-Mail Removed)> wrote:

> > You can't see event handlers that are attached by attachEvent or
> > addEventListener

>
> You got it. That is what i meant.
>
> Even before posting the question i viewed the source and was not able
> to find any of the first 2 ways you suggested. Actually my question
> was how to find events added addEventListener in IE?


Would you say: "events added attachEvent in IE"? (addEventListener is
for Firefox)
If you can't find it in the page source then look through included
javascript files.
It is only way. Reverse engineering is not easy occupation.

Regards,
Mykola
http://marss.co.ua


 
Reply With Quote
 
marss
Guest
Posts: n/a
 
      09-07-2007
On 7 , 12:10, wolverine <(E-Mail Removed)> wrote:

> Even before posting the question i viewed the source and was not able
> to find any of the first 2 ways you suggested.


In the page source:
window.google.ac.InstallAC(document.f,document.f.q ,document.f.btnG,"search","en");

In the included file http://www.google.com/extern_js/f/Cg...ST7u151leI.js:
r.InstallAC=function(a,b,c,e,d,g,i,j,D)...

Regards,
Mykola
http://marss.co.ua

 
Reply With Quote
 
wolverine
Guest
Posts: n/a
 
      09-07-2007
On Sep 7, 2:32 pm, marss <(E-Mail Removed)> wrote:
> On 7 , 12:10, wolverine <(E-Mail Removed)> wrote:
>
> > > You can't see event handlers that are attached by attachEvent or
> > > addEventListener

>
> > You got it. That is what i meant.

>
> > Even before posting the question i viewed the source and was not able
> > to find any of the first 2 ways you suggested. Actually my question
> > was how to find events added addEventListener in IE?

>
> Would you say: "events added attachEvent in IE"? (addEventListener is
> for Firefox)
> If you can't find it in the page source then look through included
> javascript files.
> It is only way. Reverse engineering is not easy occupation.


True. I was unable to reverse engineer it. So only i posted it in this
groups. I know this groups is
not the place to get my home work done. I just wanted to know any
other means of checking whether an event is attached to an element in
IE. But a guy named "Randy Webb" completely misunderstood the
question and asked me to view the source which i had done in the first
place. Partly it was my
mistake of not putting down my question in crystal clear words. Any
way thanks for the help.

>
> Regards,
> Mykolahttp://marss.co.ua



 
Reply With Quote
 
Noah Sussman
Guest
Posts: n/a
 
      09-07-2007
On Sep 7, 5:10 am, wolverine <(E-Mail Removed)> wrote:
> Actually my question
> was how to find events added addEventListener in IE?


Afaik there is no way to find out which events have been attached
using addEventListener.

So, as was suggested above, you would have to read the code. In
Firefox, you can use the Web Developer Toolbar's Information menu
(https://addons.mozilla.org/en-US/firefox/addon/60) to dump all of the
scripts associated with the page. That will give you a convenient, in-
browser way to read through everything and find the place where the
event is attached to the input field for IE.

I would suggest that you search for calls to addEventListener. Look
at the parameter list for each call, so that you can find where the
input field is being passed. Since the input field does not have an
ID, you will have to figure out how the Google devs passed that DOM
element to their script.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Windows XP freezes when USB mouse/keyboard are attached but not when a serial set is attached John Dalberg Computer Support 4 06-17-2007 09:27 AM
When I turn on my PC, it works, works, works. Problem! Fogar Computer Information 1 01-17-2006 12:57 AM
Seek JS/DHTML for input box like one at Google Suggest gimme_this_gimme_that@yahoo.com Javascript 5 11-23-2005 03:04 PM
After rebooting my PC works, works, works! Antivirus problem? Adriano Computer Information 1 12-15-2003 05:30 AM



Advertisments