Jsp code:
Copy codeThe Code is as follows:
<Form id = "search">
<Select id = "jobSelect" style = "width: 200px;" name = "jobSelect">
<S: if test = 'jobselect = null | jobSelect = "" '>
<Option selected = "selected" value = "-1"> -- category-based filtering -- </option>
</S: if>
<S: else>
<Option value = "-1"> -- category-based filtering -- </option>
</S: else>
<S: iterator value = "jobCat" status = "s">
<S: if test = "jobSelect = catKey">
<Option value = "<s: property value =" catKey "/>" selected = "selected">
<S: property value = "catCnName"/>
</Option>
</S: if>
<S: else>
<Option value = "<s: property value =" catKey "/>">
<S: property value = "catCnName"/>
</Option>
</S: else>
</S: iterator>
</Select> <br/>
<Select id = "areaSelect" style = "width: 200px;" name = "areaSelect">
<S: if test = 'areaselect = null | areaSelect = "" '>
<Option selected = "selected" value = "-1"> -- filter by region -- </option>
</S: if>
<S: else>
<Option value = "-1"> -- filter by region -- </option>
</S: else>
<S: iterator value = "workAreaCat" status = "s">
<S: if test = "areaSelect = areaCat">
<Option value = "<s: property value =" areaCat "/>" selected = "selected">
<S: property value = "catCnName"/>
</Option>
</S: if>
<S: else>
<Option value = "<s: property value =" areaCat "/>">
<S: property value = "catCnName"/>
</Option>
</S: else>
</S: iterator>
</Select>
<Input class = "send2" type = "button" onclick = "validate (); return false" value = "query"/>
<Span style = "color: red;" mce_style = "color: red;" id = "requiredParam"> </span>
</Form>
Js Code:
Copy codeThe Code is as follows:
<Mce: script type = "text/javascript"> <! --
Validate = function (){
Var jobSelect;
Var areaSelect;
Var search = document. getElementById ("search ");
For (var I = 0; I <search. jobSelect. length; I ++ ){
If (search. jobSelect [I]. selected ){
JobSelect = search. jobSelect [I]. value;
}
}
For (var I = 0; I <search. areaSelect. length; I ++ ){
If (search. areaSelect [I]. selected ){
AreaSelect = search. areaSelect [I]. value;
}
}
If (jobSelect =-1 & areaSelect =-1 ){
Document. getElementById ('requiredparam'). innerHTML = 'Please set the filter conditions and query ';
Return;
}
Var param = {
Target: '../Index/JobFrame. action ',
Method: 'post ',
Form: 'search ',
Div: 'box'
}
Var as = new AjaxSender (param );
As. send ()
}
// --> </Mce: script