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

W

wolverine

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.
 
W

wolverine

wolverine said the following on 9/6/2007 9:33 AM:


I don't, I find it very annoying.

If every body was the same world would be very boring.
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
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

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
 
M

marss

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.
 
M

marss

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
 
W

wolverine

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?
 
M

marss

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
 
W

wolverine

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.
 
N

Noah Sussman

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top