Header

  1. View current page

    dsdstudio님의 노트

Profile_img_60x60_01
1

2007년 5월

 2007.5.8

오늘 발표중 나온 DOM 객체 및 Function 정리 .

 

navigator.screen

 

document.cookieEnabled (boolean)

document.javaEnabled (boolean)

string.split(delim)

string.join(delim)

escape(String) / unescape (String)

encodeURI(String)

 

substr(index1, integer) 예제

문자열을 index1로 지정한 위치로부터 integer로 지정하는 길이만큼의 문자열 return 합니다.

Source code

<body>
<script type="text/javascript">
<!--
var str = "Web design"
document.write(str.substr(0, 3) + "<br />") // 0에서 부터 3개 = Web
document.write(str.substr(4, 6) + "<br />") // 4에서 부터 6개 = design
document.write(str.substr(2, 3) + "<br />") // 2에서 부터 3개 = b d
// -->
</script>
</body>
Count 0 1 2 3 4 5 6 7 8 9
String W e b space d e s i g n

substring(index1, index2) 예제

문자열을 index1부터 index2 이전 까지의 문자열 return 합니다. 이 때 index2가 index1 보다 크다고 가정합니다. index1만 주면 그 이후의 문자를 모두 return 하고 index를 주지 않으면 전체를 return 합니다.

Source code

<body>
<script type="text/javascript">
<!--
var str = "Web design"
document.write(str.substring(0, 3) + "<br />")
document.write(str.substring(3, 0) + "<br />")
document.write(str.substring(2) + "<br />")
document.write(str.substring())
// -->
</script>
</body>
Count 0 1 2 3 4 5 6 7 8 9
String W e b space d e s i g n

History

Last edited on 01/02/2008 13:16 by dsdgun

Comments (0)

You must log in to leave a comment. Please sign in.