[code]
<script>
var isNS6=navigator.userAgent.indexOf("Gecko")!=-1?true:false;
var isIE=document.all?true:false;
function showhideinline(oDiv,flag){
if(isIE) {
if (flag) oDiv.style.display="inline" //if flag true - show the div
else oDiv.style.display="none"
}
else if(isNS6){
if (flag) document.getElementById("oDiv").style.display="inline" //if flag true - show the div
else document.getElementById("oDiv").style.display="none"
}
}
</script>
[/code]
위와 같은 코드로 체크박스를 선택하면 레이어가 보여지는 기능을 만들었습니다.
여기서 문제는 글을 수정하면 체크박스만 체크되고 레이어는 안보여진다는 겁니다 ㅠ
고수님들 답변부탁드립니다 ㅠ
<script>
var isNS6=navigator.userAgent.indexOf("Gecko")!=-1?true:false;
var isIE=document.all?true:false;
function showhideinline(oDiv,flag){
if(isIE) {
if (flag) oDiv.style.display="inline" //if flag true - show the div
else oDiv.style.display="none"
}
else if(isNS6){
if (flag) document.getElementById("oDiv").style.display="inline" //if flag true - show the div
else document.getElementById("oDiv").style.display="none"
}
}
</script>
[/code]
위와 같은 코드로 체크박스를 선택하면 레이어가 보여지는 기능을 만들었습니다.
여기서 문제는 글을 수정하면 체크박스만 체크되고 레이어는 안보여진다는 겁니다 ㅠ
고수님들 답변부탁드립니다 ㅠ
댓글 7개
addEventListener나 attachEvent는 이벤트와 관련된 것이지 지금처럼 check 코드와는 상관이 없어보이는데요...
그리고 함수 showhideinline의 파라미터를 보면 oDiv, flag이렇게 두개를 받고 있는데 oDiv라 하면 div 오브젝트를 파라미터로 받는다는 것인데 ie에서는 잘한것 같은데 ns에서는 document.getElementById('oDiv') ? 이게 뭡니까??? oDiv가 div의 ID도 되나요???
먼저 디자이너몽이 원하는 게 뭔지 알아야 답변을 유추할 수 있를 것 같은데, 글쓰기에서 체크박스에 선택을 하고 글수정하면 업데이트 된 이후에 그 글을 볼 때 레이어가 나타나게 하려는 겁니까? 아니면 체크박스에 선택한 순간에 레이어가 보이고자 하는 겁니까?
그리고 함수 showhideinline의 파라미터를 보면 oDiv, flag이렇게 두개를 받고 있는데 oDiv라 하면 div 오브젝트를 파라미터로 받는다는 것인데 ie에서는 잘한것 같은데 ns에서는 document.getElementById('oDiv') ? 이게 뭡니까??? oDiv가 div의 ID도 되나요???
먼저 디자이너몽이 원하는 게 뭔지 알아야 답변을 유추할 수 있를 것 같은데, 글쓰기에서 체크박스에 선택을 하고 글수정하면 업데이트 된 이후에 그 글을 볼 때 레이어가 나타나게 하려는 겁니까? 아니면 체크박스에 선택한 순간에 레이어가 보이고자 하는 겁니까?
body 태그의 onload 또는 자바스크립트에서 window.onload 시에 처리되는 구문이 있을겁니다.
그 구문이 중복되어 처리가 되지 않는 것입니다.
if (window.addEventListener) {
} else if (window.attachEvent) {
}
구문안에 onload 이벤트시 호출되는 함수나 스크립트들을 넣어주시면 됩니다.
url을 직접 알려주시면 내용을 쉽게 이해할수 있는데, 위와 같이 단편적인 정보만 주면,
무엇이 문제인지 이해하기가 어렵습니다.(지금은 두가지 내용을 섞어놔서 아무도 이해를 못하는 것입니다.)
그 구문이 중복되어 처리가 되지 않는 것입니다.
if (window.addEventListener) {
} else if (window.attachEvent) {
}
구문안에 onload 이벤트시 호출되는 함수나 스크립트들을 넣어주시면 됩니다.
url을 직접 알려주시면 내용을 쉽게 이해할수 있는데, 위와 같이 단편적인 정보만 주면,
무엇이 문제인지 이해하기가 어렵습니다.(지금은 두가지 내용을 섞어놔서 아무도 이해를 못하는 것입니다.)
// JavaScript Document
var isNS6=navigator.userAgent.indexOf("Gecko")!=-1?true:false;
var isIE=document.all?true:false;
function showhideinline(sId,flag){
var oDiv = document.getElementById(sId);
if(isIE) {
if (flag) oDiv.style.display="inline" //if flag true - show the div
else oDiv.style.display="none"
}
else if(isNS6){
if (flag) oDiv.style.display="inline" //if flag true - show the div
else oDiv.style.display="none"
}
}
자바스크립트는 이렇게 하면 될 것같습니다.
그리고 이걸 수정모드에서 자동으로 올라오게 하려면 onload함수를 이용해서 만들어보면 이렇게 되지 않을까 싶네요:
window.onload = function() {
var onload = window.onload;
showhideinline('a1', document.getElementsByName('seven38')[0].checked);
showhideinline('a2', document.getElementsByName('seven39')[0].checked);
showhideinline('a3', document.getElementsByName('seven40')[0].checked);
onload();
}
아참 그리고 스킨에서
<input type=checkbox name="seven38" value="1" onclick='showhideinline(a1,this.checked)' checked>세균
<input type=checkbox name="seven39" value="1" onclick='showhideinline(a2,this.checked)' >바이러스
<input type=checkbox name="seven40" value="1" onclick='showhideinline(a3,this.checked)' >기생충
를 찾아서
<input type=checkbox name="seven38" value="1" onclick="showhideinline('a1',this.checked)" checked>세균
<input type=checkbox name="seven39" value="1" onclick="showhideinline('a2',this.checked)" >바이러스
<input type=checkbox name="seven40" value="1" onclick="showhideinline('a3',this.checked)" >기생충
로 바꾸어 주세요.
var isNS6=navigator.userAgent.indexOf("Gecko")!=-1?true:false;
var isIE=document.all?true:false;
function showhideinline(sId,flag){
var oDiv = document.getElementById(sId);
if(isIE) {
if (flag) oDiv.style.display="inline" //if flag true - show the div
else oDiv.style.display="none"
}
else if(isNS6){
if (flag) oDiv.style.display="inline" //if flag true - show the div
else oDiv.style.display="none"
}
}
자바스크립트는 이렇게 하면 될 것같습니다.
그리고 이걸 수정모드에서 자동으로 올라오게 하려면 onload함수를 이용해서 만들어보면 이렇게 되지 않을까 싶네요:
window.onload = function() {
var onload = window.onload;
showhideinline('a1', document.getElementsByName('seven38')[0].checked);
showhideinline('a2', document.getElementsByName('seven39')[0].checked);
showhideinline('a3', document.getElementsByName('seven40')[0].checked);
onload();
}
아참 그리고 스킨에서
<input type=checkbox name="seven38" value="1" onclick='showhideinline(a1,this.checked)' checked>세균
<input type=checkbox name="seven39" value="1" onclick='showhideinline(a2,this.checked)' >바이러스
<input type=checkbox name="seven40" value="1" onclick='showhideinline(a3,this.checked)' >기생충
를 찾아서
<input type=checkbox name="seven38" value="1" onclick="showhideinline('a1',this.checked)" checked>세균
<input type=checkbox name="seven39" value="1" onclick="showhideinline('a2',this.checked)" >바이러스
<input type=checkbox name="seven40" value="1" onclick="showhideinline('a3',this.checked)" >기생충
로 바꾸어 주세요.
게시글 목록
| 번호 | 제목 |
|---|---|
| 284508 | |
| 284499 | |
| 284492 | |
| 284490 | |
| 284484 | |
| 284481 | |
| 284478 | |
| 284476 | |
| 284474 | |
| 284472 | |
| 284470 | |
| 284458 | |
| 284457 | |
| 284454 | |
| 284453 | |
| 284447 | |
| 284446 | |
| 284444 | |
| 284441 | |
| 284440 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기