chiark / gitweb /
prefer to use ids to names; names aren't even valid in divs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 12 Aug 2009 10:50:18 +0000 (11:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 12 Aug 2009 10:50:18 +0000 (11:50 +0100)
yarrg/web/pirate-route

index 612c577..c80bacf 100644 (file)
@@ -95,7 +95,7 @@ function tr_Later(){
 }
 function tr_Needed(){
   window.clearTimeout(tr_timeout);
-  //tr_element= document.getElementsByName('routestring').item(0);
+  tr_element= document.getElementById('routestring');
   //alert(tr_element.name);
   tr_needed= tr_element.value;
   tr_Request();
@@ -115,7 +115,7 @@ function tr_Ready() {
     response= tr_request.responseText;
     //alert('got [[ '+response+' ]]');
     eval('results='+response);
-    toedit= document.getElementsByName('routeresults').item(0);
+    toedit= document.getElementById('routeresults');
     toedit.innerHTML= results['show'];
   }
   tr_request= false;
@@ -123,11 +123,10 @@ function tr_Ready() {
 }
 </script>
 
-<input type="text" name="routestring" size=80
- onchange="tr_element= event.currentTarget; tr_Needed();"
- onkeyup="tr_element= event.currentTarget; tr_Later();"><br>
-<div name="routeresults">&nbsp;</div><br/>
-
+<input type="text" id="routestring" name="routestring" size=80
+ onchange="tr_Needed();"
+ onkeyup="tr_Later();"><br>
+<div id="routeresults">&nbsp;</div><br/>
 % } else {
 
 <%perl>