JavaScript validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • keydrive
    New Member
    • Oct 2007
    • 57

    JavaScript validation

    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


    Code:
    <script language="JavaScript">
    
    	function Submit()
    	{
    		if(window.event && window.event.keyCode == 13)
    		{            
    			document.QueryForm.pageNum.value='1';
    			document.QueryForm.submit();
    		}
    		else { return true; }
    	}
    
    </script>  
    
    <form action=search.jsp name="QueryForm">
    Enter query text:<input type="text" name="query" value="<%=query%>" size="50" onkeypress="return Submit()">
    <input type="submit"  onclick="javascript:Submit();"/>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

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

    Comment

    Working...