조회 : 105
#소스
<!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에서는 완벽하게 구분한다.
제목 |
---|
[기본형] HTML (with 부트스트랩5.3 , jquery 3.7, vue.js) |
유용한 리눅스(LINUX) 명령어 |
[공지] 기술 게시판 |
일 |
월 |
화 |
수 |
목 |
금 |
토 |
---|---|---|---|---|---|---|
4.28
|
4.29
|
4.30
|
5.1
|
5.2
|
5.3
|
5.4
|
5.5
|
5.6
|
5.7
|
5.8
|
5.9
|
5.10
|
5.11
|
5.12
|
5.13
|
5.14
|
5.15
|
5.16
|
5.17
|
5.18
|
5.19
|
5.20
|
5.21
|
5.22
|
5.23
|
5.24
|
5.25
|
5.26
|
5.27
|
5.28
|
5.29
|
5.30
|
5.31
|
6.1
|