By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,480 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,480 IT Pros & Developers. It's quick & easy.

JavaScript validation

P: 57
Eclipse is erroring on the onkeypress line of the code below with;

Multiple annotations found at this line:
- Tag (input) should be an empty-element tag.
- Cannot return from outside a function or method.
- Invalid text string ()

Now, I have use this in the past but now with Eclipse 10 it is erroring.

Any suggestions would be great.
Thanks


Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2.  
  3.     function Submit()
  4.     {
  5.         if(window.event && window.event.keyCode == 13)
  6.         {            
  7.             document.QueryForm.pageNum.value='1';
  8.             document.QueryForm.submit();
  9.         }
  10.         else { return true; }
  11.     }
  12.  
  13. </script>  
  14.  
  15. <form action=search.jsp name="QueryForm">
  16. Enter query text:<input type="text" name="query" value="<%=query%>" size="50" onkeypress="return Submit()">
  17. <input type="submit"  onclick="javascript:Submit();"/>
  18.  
  19.  
Apr 11 '12 #1

✓ answered by Dormilich

a) you mix languages, therefore Eclipse has problems. try in a browser.
b) the function seems pointless (with the given code)

Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
a) you mix languages, therefore Eclipse has problems. try in a browser.
b) the function seems pointless (with the given code)
Apr 11 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.