Keydown, keypressed? input without inputbox

S

Shirenseru

Hi,

I recently saw on a website, that there was a possibility that when
you're on a certain webpage,

and you type like " code " on your keyboard, that some function is
being called.
Does anyone has experience with this?

Cause i would really like some help..

I would like on a page, when typing " admin " that your current window
is being redirected to another page.

Like i have my html page. i type " google " and suddently i'm
redirected to www.google.com. The thing is, you don't see what you
type. Thats the whole idea behind this.

I hope people understand me,

Thanks in advance
 
R

Randy Webb

Shirenseru said the following on 5/11/2006 5:29 AM:
Hi,

I recently saw on a website, that there was a possibility that when
you're on a certain webpage,

and you type like " code " on your keyboard, that some function is
being called.
Does anyone has experience with this?

onkeydown/up on the window object.
Cause i would really like some help..

I would like on a page, when typing " admin " that your current window
is being redirected to another page.

That's counter-intuitive.
Like i have my html page. i type " google " and suddently i'm
redirected to www.google.com. The thing is, you don't see what you
type. Thats the whole idea behind this.

And if you type it wrong?
 
S

Shirenseru

Well i mean when you type

" adm " and then " p "

it should break. But when the followup is " admin " only then, the
page should open www.google.com

could you give me an example?
 
A

ASM

Vic Sowers a écrit :
Try something like:

this bellow works in my FireFox

<body>
<h1>Blind Entry Test</h1>

<script type="text/JavaScript">
buffer = "";
onkeyup = MonitorTyping;
function MonitorTyping(e) {
e = e || event;
buffer += String.fromCharCode(e.keyCode).toLowerCase();
if (buffer.indexOf("admp")>=0) location = "http://Yahoo.com";
if (buffer.indexOf("admin")>=0) location = "http://Google.com";
</script>

</body>
</html>
 
R

Randy Webb

Shirenseru said the following on 5/11/2006 5:50 AM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

Hey i got it!

http://webdeveloper.earthweb.com/webjs/jstext/item.php/822271

this was what i meant.

but instead of that msgbox i want to open a link in the same window.

Change this line of code:

var code = "code"; //no spaces no special chars

To something like this:

var code="admin";

And then, change this line of code:

alert("You typed the code!")

to this:

window.location = 'http://www.google.com/';
 

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,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top