Javascript < if statement

Associate
Joined
28 May 2008
Posts
346
got these elements on a webform

Code:
<html:text name="portalSiteForm" property="test.minimumsalary" styleClass="input10" />

<html:text name="portalSiteForm" property="test.maximumsalary" styleClass="input10" />

want to use JScript to check if the value in 'test.minimumsalary' is less than value user will input in 'test.maximumsalary'

If possible I want the valadation to be carried out when the user inputs the value into 'test.maximumsalary' rather than after hitting submit. This is what I tried but not sure if its incorrect or just not functioning on my local copy..

Code:
<SCRIPT TYPE="TEXT/JAVASCRIPT">

// Check salarys
function check() {
  if (#test\\.maximumsalary.value) > (#test\\.minimumsalary.value)  {
    alert ("NO")
  }
}
</SCRIPT>

adding a onChange() to the 'test.maximumsalary'

Code:
<html:text name="portalSiteForm" property="recruitni.maximumsalary" styleClass="input10" onchange=check() />

should be onclick maybe? Thanks for any help :)
 
Back
Top Bottom