스

자바스크립트 오류인데요^^ 도와주실분^^

· 2012-06-06 (수) 14:26:24 · 1018 · 1
function moveLayer(strlayer,width,height,evt) {

var theObj;

if (navigator.appName == 'Netscape' && document.layers != null)
theObj = eval("document.layers['" + strlayer + "']");
else if (document.all != null) //IE
theObj = eval("document.all['" + strlayer + "'].style");


var windowWidth = document.body.scrollWidth;
if(theObj) {

if (windowWidth<1180){
theObj.pixelLeft = evt.x+5-200;
theObj.pixelTop = evt.y+5+document.body.scrollTop;
}else{
theObj.pixelLeft = evt.x+5-200;
theObj.pixelTop = evt.y+5+document.body.scrollTop;
}
}
}


>>

theObj = eval("document.all['" + strlayer + "'].style");

여기 코드에서 에러나오느데요 스타일을 못찾는다고 하네욤~~ 스타일을 지워도 안되서 올려보와욤^^

도와주실분^^
|

댓글 1개

위 코드를 왜 eval 로 처리하는지 모르겠군요. 불필요한데..
if(document.getElementById)
theObs = document.getElementById(strlayer); // DOM
else if (document.layers)
theObj = document.layers[strlayer]; // NN
else if (document.alll) // IE < IE7, 스트릿모드 생략
theObj = document.all[strlayer];

// 스타일처리시
theObj.style.........
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

6,077건

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
12-07-05 조회 1,025
12-07-03 조회 982
12-07-03 조회 984
12-07-02 조회 956
12-07-02 조회 871
12-06-30 조회 1,213
12-06-26 조회 936
12-06-22 조회 917
12-06-22 조회 882
12-06-21 조회 803
12-06-21 조회 1,049
12-06-20 조회 1,237
12-06-20 조회 1,129
12-06-20 조회 1,062
12-06-18 조회 1,609
12-06-17 조회 1,069
12-06-15 조회 906
12-06-14 조회 827
12-06-13 조회 1,514
12-06-11 조회 968
12-06-08 조회 1,229
12-06-06 조회 867
12-06-06 조회 1,278
12-06-05 조회 859
12-06-04 조회 955