Developement/Web
여러개의 검색조건 처리
highheat
2007. 2. 11. 11:51
선택된 조건중 값이 비어있는것을 제외하고 값이 있는것만 조건비교를 처리
<script>
var findProdGroup = "a";
var findCate01 = "b";
var findCate02 = "";
var findCate03 = "";
var col0 = "a";
var col1 = "b";
var col2 = "c";
var col3 = "d";
if( col0 == (findProdGroup == ""?col0:findProdGroup) &&
col1 == (findCate01 == ""?col1:findCate01) &&
col2 == (findCate02 == ""?col2:findCate02) &&
col3 == (findCate03 == ""?col3:findCate03) )
alert(true);
else
alert(false);
</script>
<script>
var findProdGroup = "a";
var findCate01 = "b";
var findCate02 = "";
var findCate03 = "";
var col0 = "a";
var col1 = "b";
var col2 = "c";
var col3 = "d";
if( col0 == (findProdGroup == ""?col0:findProdGroup) &&
col1 == (findCate01 == ""?col1:findCate01) &&
col2 == (findCate02 == ""?col2:findCate02) &&
col3 == (findCate03 == ""?col3:findCate03) )
alert(true);
else
alert(false);
</script>