Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- It
- XML
- cookie
- 제네릭
- IT 관련
- angularJS
- LINQ
- delegate
- 디자인패턴
- di
- Generic
- jQuery
- JavaScript
- MSSQL
- Excel
- 클래스
- asp.net mvc
- ASP.NET
- 메소드
- mvc
- SQL
- 구글
- ADO.NET
- csv
- 동적dom
- IT관련
- iframe
- c#
- Today
- 438
- Total
- 1,440,157
심재운 블로그
javascript 로 guid 만들기 본문
https://stackoverflow.com/a/105074
function guid() {
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
document.getElementById('jsGenId').addEventListener('click', function() {
document.getElementById('jsIdResult').value = guid();
})
input { font-family: monospace; }
<button id="jsGenId" type="button">Generate GUID</button>
<br>
<input id="jsIdResult" type="text" placeholder="Results will be placed here..." readonly size="40"/>
'프로그래밍 > JavaScript' 카테고리의 다른 글
javascript 숫자 8자리 형식을 년-월-일 형식으로 보이기 (0) | 2019.05.10 |
---|---|
javascript 로 숫자에 소수점 여부 확인하기 (0) | 2019.01.07 |
javascript 로 guid 만들기 (0) | 2018.05.08 |
자바스크립트 하이라이트 라이브러리 highlight.js (0) | 2018.01.23 |
YouTube Player API 유투브 플레이어 api 사용해 보기 (0) | 2017.10.31 |
facebook login, Graph API, Sharing 알아보기 (www.fbrell.com) (0) | 2017.10.13 |
0 Comments