Jump to content

Recommended Posts

Heya,

 

I'm trying to create an input field that's supposed to redirect me to a page, with a variable the value of the input, when I press enter, but I'm failing..

 

<input id="search" type="text" value=" search .." onkeypress="if(window.event && window.event.keyCode == 13) {window.location = 'blank.php?search='+document.getElementById('search').value;}" />

Link to comment
https://forums.phpfreaks.com/topic/241539-detect-return-and-redirect/
Share on other sites

Ermm Okay.. What I now have is this

 

<script type="javascript">
fsearch(){
if (event.keyCode==13){
window.location = "blank.php?search="+document.getElementById('search').value;
}
}
</script>

 

<input id="search" type="text" value=" Search .." onkeydown="fsearch()"/>

 

but it's still not redirecting me, it's just reloading the current page :s

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.