Skip to content
HTMLPHPMSQL
2018.01.31 17:58

자바스크립트 명령어

조회 수 12894 추천 수 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

 

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

 

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

?

  1. 25
    Mar 2023
    09:54

    윈도우10 운영체제에 크롬브라우저를 사용할 때 웹사이트 인증서 설치하는 방법

    Category컴퓨터잡담 Views15606
    Read More
  2. 25
    Mar 2023
    09:40

    파이썬에서 captCha 분석 프로그램을 만들 수 있을까?

    Category파이썬 Views11714
    Read More
  3. 24
    Mar 2023
    17:36

    구글 스프레드시트에서 O열=입금완료 가 있는 행은 행 전체가 노란색으로 변하게 하기

    Category[Docs]스프레드시트 Views10046
    Read More
  4. 19
    Mar 2023
    10:04

    수 0, 1, 3, 4, 6, 7, 8을 한 번씩만 사용하여 만든 일곱 자리 수입니다. 6750000보다 크고 6800000보다 작은 수 입니다. 일의 자리 숫자와 백의 자리 숫자의 합은 십의 자리 숫자와 같습니다. 조건4) 백의 자리 숫자는 일의 자리 숫자보다 작습니다. 위의 조건을 모두 만족하는 수를 구하시오.

    Category재미재미 Views8854
    Read More
  5. 19
    Mar 2023
    08:50

    은행에 예금한 돈 35200000원을 100만원 짜리와 10만원 짜리 수표로만 찾았더니 수표가 모두 55장이었습니다. 은행에서 찾은 100만원 짜리 수표는 몇 장입니까?

    Category재미재미 Views7517
    Read More
  6. 17
    Mar 2023
    22:07

    녹화기 Play Mode

    Category컴퓨터잡담 Views6780
    Read More
  7. 15
    Mar 2023
    04:01

    웹 페이지에서 동적으로 생성되는 데이터 가져오는 방법

    Category파이썬 Views6934
    Read More
  8. 13
    Mar 2023
    22:51

    아진산업 기업분석 및 전망

    Category주식 Views7445
    Read More
  9. 13
    Mar 2023
    18:23

    전기선 + PIR 감지기 + LED 결선도

    Category회로도전자부품 Views3646
    Read More
  10. 12
    Mar 2023
    22:10

    디지캡 한동훈 수혜이슈와 기업분석 및 전망

    Category주식 Views3191
    Read More
Board Pagination Prev 1 2 3 4 5 ... 235 Next
/ 235

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소