Browse Source

don't search when enter is hit on username field

raylu 14 years ago
parent
commit
569d9165ef
2 changed files with 8 additions and 1 deletions
  1. 7 0
      static/script.js
  2. 1 1
      templates/p.html

+ 7 - 0
static/script.js

@@ -213,6 +213,13 @@ function search(query) {
 	return false;
 }
 
+function userKeyPress(e) {
+	if (e.keyCode == 13) {// enter
+		$('#song').focus();
+		return false;
+	}
+}
+
 function add(id, title) {
 	params = {
 		pid: pid,

+ 1 - 1
templates/p.html

@@ -5,7 +5,7 @@
 	<img src="/static/audioaxis-white.png" alt="Audio Axis" class="aa">
 	<form onsubmit="return search(this.song.value)">
 		<label for="user">Username:</label>
-		<input type="text" id="user" value="anonymous" size="16">
+		<input type="text" id="user" value="anonymous" size="16" onkeypress="return userKeyPress(event)">
 		<br>
 		<label for="song">Add a song:</label>
 		<input type="text" id="song" autocomplete="off">