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

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 .

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$>

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

On 7 , 12:10, wolverine <> 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.

On Sep 7, 2:32 pm, marss <> wrote:
> On 7 , 12:10, wolverine <> 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

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.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!