논리연산 질문입니다...
휘율
tr
th scope=row 전년도 매출액 /th
td align=left
input type=text name=SalesPrice class=eng size=10/label for=SalesPrice 백만원/label/td
th scope=row상시근로자수 /td
td align=left
input type=text name=WorkerNum class=kor size=15/label for=WorkerNum 명/label
/td
/tr
로 값을 받아오고.....
var SalesPrice = document.getElementById(SalesPrice).value;
var WorkerNum = document.getElementById(WorkerNum).value;
if(SalesPrice == null && WorkerNum != null){
var SalesPrice = null;
var WorkerNum = document.getElementById(WorkerNum).focus();
return false;
}else if(SalesPrice != null && WorkerNum == null)){
var WorkerNum = null;
var SalesPrice = document.getElementById(SalesPrice).focus();
return false;
}else if(SalesPrice == null && WorkerNum == null) {
alert(매출액또는 상시근로자수를 입력해주세요); return false;
}
이런식으로 둘중 하나만 값을 받으려고 하는데... 안되네요....
어디가 잘못된건가요?
-
냐하
다른사람이 짜놓은 소스 고치는 중인데... id 없이 저리 해도 값이 호출이 되더라구요...
그래서 넘어가기로 하고 진행중인....
ㅎㅎ 덕분에 해결 됬네요~ 감사합니다~ -
볼매
SalesPrice라는 변수값으로 0이 할당되는것과
화면상에 있는 input value에 0이 할당되는것과는 엄연히 다릅니다..
input value에 할당되려면..
document.getElementById(\Sales\).value = 0; 이게 맞겠죠..
이거 원하는게 맞는지도 잘 모르겠군요;;
그리고..
var WorkerNum = document.getElementById(\WorkerNum\).focus();
이건 뭘 하고싶은건지 잘 모르 -
레나
그럼 if(!SalesPrice && WorkerNum){
var SalesPrice = 0;
var WorkerNum = document.getElementById(\WorkerNum\).focus();
return false;
이리하면 SalesPrice 값은 0이 들어가는건가요? -
그림자
게다가 value는 \\이 나오지 null이 나오지 않을듯..