link가 있는 이미지의 경우 popup 하지 않게 하는 방법?

img의 link ( <a href ...><img src=...></a> )가 있는 경우
image의 popup을 하지 않게 하는 java script가 어떻게 가능할까요?
|

댓글 4개

var element = document.getElementById(a 태크의 아이디?);

var firstElement = element.childNodes[0];

if(!firstElement)
{
팝업소스?
}

이런식으로 하면 될것 같습니다. ㅎㅎ
<a href=http://freeimage.kr >test not blank</a><BR>
<a href=http://freeimage.kr ><img src=http://www.google.co.kr/images/nav_logo7.png ></a><BR>
<a href=http://freeimage.kr ><img src=http://www.google.co.kr/images/nav_logo7.png ></a><BR>
<script>
var imgs,i;
hrefs=document.getElementsByTagName('a');
for(i in hrefs)
{
if (hrefs[i].href) {
if (hrefs[i].childNodes[0].nodeName=="IMG")
hrefs[i].target='_self';
}
}

</script>
하면되겠구요.. href=가 javascript:면 다른 방법을 사용해야 하겠군요..
<span id="writeContents">
<a href="http://sir.co.kr"><img src="" onclick="window.open('', '', '')" /></a>
</span>


<script type="text/javascript">
function link_auto_target_inarea(Container)
{
var A_tag = Container.getElementsByTagName("A");

for (var i=0; i<A_tag.length; i++)
{
IMG_tag = A_tag[i].getElementsByTagName("IMG");

for (var k=0; k<IMG_tag.length; k++)
{
if (IMG_tag[k].getAttribute("ONCLICK") != null)
{
IMG_tag[k].onclick = "";
}
}
}

return;
}

link_auto_target_inarea(document.getElementById('writeContents'));
</script>

생각대로 하는 소스~~
질문이 부적절하다고 생각되어, 다시 10만 포인트 걸구 질문 합니다. ㅠ..ㅠ...
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
16년 전 조회 1,478
16년 전 조회 934
16년 전 조회 1,513
16년 전 조회 1,426
16년 전 조회 1,663
16년 전 조회 1,190
16년 전 조회 1,146
16년 전 조회 1,525
16년 전 조회 1,236
16년 전 조회 1,520
16년 전 조회 2,153
16년 전 조회 1,137
16년 전 조회 1,969
16년 전 조회 1,515
16년 전 조회 900
16년 전 조회 1,055
16년 전 조회 1,672
16년 전 조회 785
16년 전 조회 1,520
16년 전 조회 7,078