Jump to content

Detect Return and Redirect


manix

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.