obj.setAttribute() 사용시 브라우저별 접근 결과

 

 

#소스

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
<title>Untitled Document</title>
</head>

<body>
<span id="span" title="txt : title">span</span><br />

<script type="text/javascript">
 var span = document.getElementById('span');
 document.write('1 : '+span.title);
 document.write('<br/>');
 span.setAttribute('title2','txt : title2_1');
 document.write('2 : '+span.title2);
 document.write('<br/>');
 span.title2 = 'xxxx';
 document.write('3 : '+span.title2);
 document.write('<br/>');
 span.setAttribute('title2','txt : title2_2');
 document.write('4 : '+span.title2);
 document.write('<br/>');
 document.write('5 : '+span.getAttribute('title2'));
 document.write('<br/>');
</script>
</body>
</html>

 

# 결과

## IE

span
1 : txt : title
2 : txt : title2_1
3 : xxxx
4 : txt : title2_2
5 : txt : title2_2

## FF

span
1 : txt : title
2 : undefined
3 : xxxx
4 : xxxx
5 : txt : title2_2

 

# 결론

IE에서는 obj.setAttribute('title2','xxxx')로 해도 obj.title2 로 한것과 같은 것으로 처리되는 것 같다.
FF에서는 완벽하게 구분한다.

댓글
  • No Nickname
    No Comment
  • 권한이 없습니다.
    {{m_row.m_nick}}
    -
제목 작성자 날짜
공대여자
공대여자
mins01
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자