Skip to content
HTMLPHPMSQL
2018.01.31 17:58

자바스크립트 명령어

조회 수 12756 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

특수문자 이스케이프 시퀀스

특수 문자(JavaScript)

 

JavaScript는 직접 입력할 수 없는 문자를 만들기 위해 문자열에 포함시킬 수 있는 이스케이프 시퀀스를 제공합니다.

 

function ConvertSystemSourcetoHtml(str){

 str = str.replace(/</g,"&lt;");

 str = str.replace(/>/g,"&gt;");

 str = str.replace(/\"/g,"&quot;");

 str = str.replace(/\'/g,"&#39;");

 str = str.replace(/\n/g,"<br />");

 return str;

}

 

HTML 특수 문자표 

 

 

표현문자

숫자표현

문자표현

설명

-

&#00;-&#08;

-

사용하지 않음

space

&#09;

-

수평탭

space

&#10;

-

줄 삽입

-

&#11;-&#31;

-

사용하지 않음

space

&#32;

-

여백

!

&#33;

-

느낌표

"

&#34;

&quot;

따옴표

#

&#35;

-

숫자기호

$

&#36;

-

달러

%

&#37;

-

백분율 기호

&

&#38;

&amp;

Ampersand

'

&#39;

-

작은 따옴표

(

&#40;

-

왼쪽 괄호

)

&#41;

-

오른쪽 괄호

*

&#42;

-

아스트릭

+

&#43;

-

더하기 기호

,

&#44;

-

쉼표

-

&#45;

-

Hyphen

.

&#46;

-

마침표

/

&#47;

-

Solidus (slash)

0 - 9

&#48;-&#57;

-

0부터 9까지

:

&#58;

-

콜론

;

&#59;

-

세미콜론

<

&#60;

&lt;

보다 작은

=

&#61;

-

등호

>

&#62;

&gt;

보다 큰

?

&#63;

-

물음표

@

&#64;

-

Commercial at

A - Z

&#65;-&#90;

-

A부터 Z까지

[

&#91;

-

왼쪽 대괄호

\

&#92;

-

역슬래쉬

]

&#93;

-

오른쪽 대괄호

^

&#94;

-

탈자부호

_

&#95;

-

수평선

`

&#96;

-

Acute accent

a - z

&#97;-&#122;

-

a부터 z까지

{

&#123;

-

왼쪽 중괄호

|

&#124;

-

수직선

}

&#125;

-

오른쪽 중괄호

~

&#126;

-

꼬리표

-

&#127;-&#159;

-

사용하지 않음

 

&#160;

&nbsp;

Non-breaking space

¡

&#161;

&iexcl;

거꾸로된 느낌표

&#162;

&cent;

센트 기호

&#163;

&pound;

파운드

¤

&#164;

&curren;

현재 환율

&#165;

&yen;

|

&#166;

&brvbar;

끊어진 수직선

§

&#167;

&sect;

섹션 기호

¨

&#168;

&uml;

움라우트

&#169;

&copy;

저작권

ª

&#170;

&ordf;

Feminine ordinal

&#171;

&laquo;

왼쪽 꺾인 괄호

&#172;

&not;

부정

 

&#173;

&shy;

Soft hyphen

?

&#174;

&reg;

등록상표

&hibar;

&#175;

&macr;

Macron accent

°

&#176;

&deg;

Degree sign

±

&#177;

&plusmn;

Plus or minus

²

&#178;

&sup2;

Superscript two

³

&#179;

&sup3;

Superscript three

´

&#180;

&acute;

Acute accent

μ

&#181;

&micro;

Micro sign (Mu)

&#182;

&para;

문단기호

·

&#183;

&middot;

Middle dot

¸

&#184;

&cedil;

Cedilla

¹

&#185;

&sup1;

Superscript one

º

&#186;

&ordm;

Masculine ordinal

&#187;

&raquo;

오른쪽 꺾인 괄호

¼

&#188;

&frac14;

4분의 1

½

&#189;

&frac12;

2분의 1

¾

&#190;

&frac34;

4분의 3

¿

&#191;

&iquest;

거꾸로된 물음표

A

&#192;

&Agrave;

Capital A, grave accent

A

&#193;

&Aacute;

Capital A, acute accent

A

&#194;

&Acirc;

Capital A, circumflex accent

A

&#195;

&Atilde;

Capital A, tilde

A

&#196;

&Auml;

Capital A, dieresis or umlaut mark

A

&#197;

&Aring;

Capital A, ring (Angstrom)

Æ

&#198;

&AElig;

Capital AE diphthong (ligature)

C

&#199;

&Ccedil;

Capital C, cedilla

E

&#200;

&Egrave;

Capital E, grave accent

E

&#201;

&Eacute;

Capital E, acute accent

E

&#202;

&Ecirc;

Capital E, circumflex accent

E

&#203;

&Euml;

Capital E, dieresis or umlaut mark

I

&#204;

&Igrave;

Capital I, grave accent

I

&#205;

&Iacute;

Capital I, acute accent

I

&#206;

&Icirc;

Capital I, circumflex accent

I

&#207;

&Iuml;

Capital I, dieresis or umlaut mark

Ð

&#208;

&ETH;

Capital Eth, Icelandic

N

&#209;

&Ntilde;

Capital N, tilde

O

&#210;

&Ograve;

Capital O, grave accent

O

&#211;

&Oacute;

Capital O, acute accent

O

&#212;

&Ocirc;

Capital O, circumflex accent

O

&#213;

&Otilde;

Capital O, tilde

O

&#214;

&Ouml;

Capital O, dieresis or umlaut mark

×

&#215;

&times;

Multiply sign

Ø

&#216;

&Oslash;

width="130"Capital O, slash

U

&#217;

&Ugrave;

Capital U, grave accent

U

&#218;

&Uacute;

Capital U, acute accent

U

&#219;

&Ucirc;

Capital U, circumflex accent

U

&#220;

&Uuml;

Capital U, dieresis or umlaut mark

Y

&#221;

&Yacute;

Capital Y, acute accent

Þ

&#222;

&THORN;

Capital Thorn, Icelandic

ß

&#223;

&szlig;

Small sharp s, German (sz ligature)

a

&#224;

&agrave;

Small a, grave accent

a

&#225;

&aacute;

Small a, acute accent

a

&#226;

&acirc;

Small a, circumflex accent

a

&#227;

&atilde;

Small a, tilde

a

&#228;

&auml;

Small a, dieresis or umlaut mark

a

&#229;

&aring;

Small a, ring

æ

&#230;

&aelig;

Small ae diphthong (ligature)

c

&#231;

&ccedil;

Small c, cedilla

e

&#232;

&egrave;

Small e, grave accent

e

&#233;

&eacute;

Small e, acute accent

e

&#234;

&ecirc;

Small e, circumflex accent

e

&#235;

&euml;

Small e, dieresis or umlaut mark

i

&#236;

&igrave;

Small i, grave accent

i

&#237;

&iacute;

Small i, acute accent

i

&#238;

&icirc;

Small i, circumflex accent

i

&#239;

&iuml;

Small i, dieresis or umlaut mark

ð

&#240;

&eth;

Small eth, Icelandic

n

&#241;

&ntilde;

Small n, tilde

o

&#242;

&ograve;

Small o, grave accent

o

&#243;

&oacute;

Small o, acute accent

o

&#244;

&ocirc;

Small o, circumflex accent

o

&#245;

&otilde;

Small o, tilde

o

&#246;

&ouml;

Small o, dieresis or umlaut mark

÷

&#247;

&divide;

Division sign

ø

&#248;

&oslash;

Small o, slash

u

&#249;

&ugrave;

Small u, grave accent

u

&#250;

&uacute;

Small u, acute accent

u

&#251;

&ucirc;

Small u, circumflex accent

u

&#252;

&uuml;

Small u, dieresis or umlaut mark

y

&#253;

&yacute;

Small y, acute accent

þ

&#254;

&thorn;

Small thorn, Icelandic

y

&#255;

&yuml;

Small y, dieresis or umlaut mark

 

 

 

 

 

특정글자 변경/삭제

 

str_text.replace("찾을 문자열", "변경할 문자열")

 

 

 자바스크립트 데이터 화면 출력

 

데이터 디스플레이와 관련된 명령어

 

● document.write( )  
: ()안에 것을 화면에 출력하라는 메서드
● window.alert()     
: 경고창을 띄워 ()안의 것을 출력하라는 메서드
 innerHTML=" "       
: 예를 가지고 이해하는 것이 빠르다. 
예를 들어 HTML로 [홍길동]이라는 콘텐츠를 화면에 출력하였다.
이 HTML 요소에 접근하여 [홍길동]을 [이순신]으로 바꿔 출력하게 만들려면 이 속성을 사용해야 한다. 그리고 HTML 요소에 접근하려면 document.getElementById 메서드를 함께 사용한다.
 

 

 

if문

var date = new Date();
var hour = date.getHours();
 
if(hour < 11) {
alert("아침");
}
else if(hour < 15) {
alert("점심");
}
else {
alert("저녁");
}

 

 

switch문

var input = Number(prompt('숫자를 입력하세요.', '숫자'));
 
switch(input % 2) {
case 0:
alert("짝수입니다.");
break;
case 1:
alert("홀수입니다.");
break;
default:
alert("숫자가 아닙니다.");
break;
}

 

 

while 반복문

1
2
3
4
5
value = 0;
while(value < 5) {
alert(value + '번째 반복');
value++;
}

do while 반복문

1
2
3
4
5
var value = 0;
do {
alert(value + '번째 반복문');
value++;
} while(value < 5);

for 반복문

1
2
3
4
5
var array = ['포도', '사과', '바나나', '망고'];
 
for(var i=0; i<array.length; i++) {
alert(array[i]);
}

for in 반복문

자바스크립트는 배열이나 객체를 더욱 쉽게 다룰 수 있도록 for in 반복문을 제공한다. 위 for 문의 예제는 아래와 같이 바꿔 사용할 수도 있다.

1
2
3
4
5
var array = ['포도', '사과', '바나나', '망고'];
 
for(var i in array) {
alert(array[i]);
}

 

 


http://meaningone.tistory.com/316

 

#자바스크립트 #데이터 #화면 #출력 #명령어

 

로그인 후 댓글쓰기가 가능합니다.

?

List of Articles
번호 분류 제목 날짜 조회 수
82 AutoHotKey Autohotkey] 키보드 후킹 테스트 file 2018.07.07 9679
81 AutoHotKey autohotkey command-line 실행시 파라미터 설정 2018.02.14 7216
80 AutoHotKey ahk) Send an email 메일발송하기 2018.01.17 9358
79 AutoHotKey Autohotkey 브라우저 제어 테스트 file 2015.01.26 8176
78 AutoHotKey ahk) autohotkey controlgettext 이름을 마우스커서에 졸졸 따라다니게 하기 file 2014.04.01 12153
77 AutoHotKey 엑셀 셀 복사하기(복사제한된 엑셀등) 1 file 2014.04.01 7778
76 AutoHotKey ahk) 오토핫키 콤보박스 제어하기 file 2013.10.30 38146
75 AutoHotKey autohotkey) 오토핫키에서 자주쓰는 함수모음 2013.10.30 33652
74 AutoHotKey ahk) autohotkey 엑셀(Excel)에서 행값 증가시키기 2013.10.30 37410
73 AutoHotKey ahk) autohotkey 글자 자르기 방법 2013.10.30 34636
72 AutoHotKey ahk) 열려진 엑셀창의 값 불러오기 1 2013.10.30 32524
71 AutoHotKey autohotkey) 30분마다 자동으로 디스크 정리하기 file 2013.07.31 33066
70 AutoHotKey Autohotkey + mypeople(마이피플) 메시지 전송 1 2013.03.12 15431
69 AutoHotKey autohotkey)매월 1일의 요일 구하기 1 2013.01.27 15262
68 AutoHotKey Ahk) 웹페이지 감시결과에 따라 마이피플로 글 전송하기 12 file 2013.01.06 43995
67 AutoHotKey autohotkey) 파일리스트 가져오기 3 2012.11.26 14973
66 AutoHotKey AHK) 보안프로그램 등으로 화면복사(Printscreen) 안될때 사용방법 1 12 file 2012.11.21 47162
65 AutoHotKey Autohotkey) EditPlus에 구문 색깔 입히기 3 file 2012.08.23 10809
64 AutoHotKey autohotkey) 런처시스템 3 2012.05.30 14285
63 AutoHotKey AHK) AUTOKEY 웹페이지 열지않고 소스 가져오기 또는 로그인 하기 14 2012.05.12 52944
Board Pagination Prev 1 2 3 4 5 Next
/ 5

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소