Js obtains the select tag value and is compatible with IE and firefox.

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.