1. HTML 버튼 클릭 2. 아래 코드를 Html 부분에 붙여넣기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 < script type = "text/javascript" > var password = '' password = prompt( '비밀번호를 입력해주세요' , '' ); if (password = = null ){ if ( window . history . length = = 0 | | window . history . length = = 1 ){ this. close () } else { window . history . back (); } } else if (passw…
JSON.stringify 를 이용하여 JSON을 Pretty하게 변경하는방법 JSON.stringify(value, replacer, space) value : 객체 space : 스페이스바 갯수 (null or 10이 최대) function GetPreetyJson(str){ return JSON.stringify(JSON.parse(str), null , 4 ) } Colored by Color Scripter cs
지정 폴더 내의 파일 내용 검색 1. 검색할 디렉토리를 지정한다 2. 해당 디렉토리에 있는 모든 파일의 리스트를 가져온다 3. 읽을 수 없는 파일을 정규식으로 걸러낸다 4. 검색할 텍스트와 일치하는 파일 이름을 출력 Program.cs using System ; using System .Collections.Generic; using System .Diagnostics; using System .IO; using System .Linq; using System .Text; using System .Text.RegularExpressions; namespace FileSearch { class Program { static void Main() { string archiveDirectory = @ "D:\\" ; string sear…
원하는 파일들만 필터링하여 압축한다. 1. 지정한 폴더의 필터를 걸어 파일의 리스트를 가져온다. 2. 해당 파일들을 압축한다. 3. 압축한 파일들을 삭제한다. public List < string > GetDirectoryFileList( string directory, string filter) { if ( Directory .Exists(directory)) { DirectoryInfo di = new DirectoryInfo(directory); List < string > fileNames = new List < string > (); foreach (var file in di.GetFiles(filter)) { fileNames.Add(file.Name); } return fileNames; } ...
Json을 입력 할 시 Key는 Header로, Value는 각 Key에 해당하는 Value로 하여 Html 테이블을 만든다. function fn_ConvertJsonToTable(oJson, titleStyle, cntntStyle) { titleStyle = [ 'font-size: 10pt; color: rgb(0, 0, 0); border: 1px solid rgb(199, 199, 199);text-align: center; width: 108px; height: 18px; background-color: rgb(243, 243, 243); font-weight: bold;' , 'font-size: 10pt; color: rgb(0, 0, 0); border: 1px solid rgb(199, 199, 199);text-align: center; width: 108px; height: 18px; background-color: rgb(243, 243, 243); font-weight: bold;' , …
JavaScript Null 또는 빈값 체크하는 코드 function IsNull(value){ if ( Boolean (value)){ console .log( "value is not null" ) } else { console.log( "value is not null" ) } } Colored by Color Scripter cs