웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
입력된 내용대로 출력하는 JS 소스코드 생성기
2003.03.25 00:54
머에 쓰는지는 모르겠씁니다.
암튼 보기 드문거네요
미리보기 : http://xscool.cafe24.com/bbs/zboard.php?id=story2&page=1&sn1=&divpage=1&category=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=21
<html>
<head>
<title>HTML-JS 생성기</title>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<style type="text/css">
th,td { font-family: 돋움; font-size: 9pt; }
textarea { font-family: Fixedsys; }
</style>
<script language="javascript">
function generateSource(form) {
var strContent = form.HTML.value;
strContent = strContent.replace(//g, "\");
strContent = strContent.replace(/"/g, """);
strContent = strContent.replace(/(r{0,1})n/g, "nn");
strContent = strContent.replace(/</script>/gi, "</","script>");
var strResult = "<script language=javascript>ndocument.write("n" + strContent + "");n</" + "script>";
form.JSSRC.value = strResult;
return false;
}
function showResult(form, src) {
var wopt = "menubar=yes,toolbar=yes,location=yes,scrollbars=yes,status=yes,resizable=yes";
switch (true) {
case form.size[1].checked: wopt += ",width=640,height=480"; break;
case form.size[2].checked: wopt += ",width=800,height=600"; break;
case form.size[3].checked: wopt += ",width=1024,height=768"; break;
}
winResult = window.open("about:blank","",wopt);
winResult.document.open("text/html", "replace");
switch (src) {
case "html": winResult.document.write(form.HTML.value); break;
case "js": winResult.document.write(form.JSSRC.value); break;
}
winResult.document.close();
return false;
}
</script>
</head>
<body style="margin:0px" onLoad="document.mainform.HTML.focus()">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4" bgColor="lightgrey">
<form name="mainform" onSubmit="return generateSource(this)">
<tr height="20">
<th align="left" colspan="2">▒ HTML-JS 생성기</th>
</tr>
<tr height="10">
<th width="50%">대상 HTML 소스코드</th>
<th width="50%">HTML 출력용 JS 소스코드</th>
</tr>
<tr>
<td width="50%"><textarea name="HTML" style="width:100%;height:100%"></textarea></td>
<td width="50%"><textarea name="JSSRC" readonly style="width:100%;height:100%"></textarea></td>
</tr>
<tr height="20">
<td colspan="2">
<input type="submit" value="JS 소스코드 생성" onClick="this.form.HTML.focus()">
<input type="button" value="HTML 미리보기" onClick="showResult(this.form,'html');this.blur()">
<input type="button" value="JS 실행결과" onClick="showResult(this.form,'js');this.blur()">
결과창 크기:
<input type="radio" name="size" checked>기본
<input type="radio" name="size">640x480
<input type="radio" name="size">800x600
<input type="radio" name="size">1024x768
</td>
</tr>
</form>
</table>
</body>
</html>
암튼 보기 드문거네요
미리보기 : http://xscool.cafe24.com/bbs/zboard.php?id=story2&page=1&sn1=&divpage=1&category=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=21
<html>
<head>
<title>HTML-JS 생성기</title>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<style type="text/css">
th,td { font-family: 돋움; font-size: 9pt; }
textarea { font-family: Fixedsys; }
</style>
<script language="javascript">
function generateSource(form) {
var strContent = form.HTML.value;
strContent = strContent.replace(//g, "\");
strContent = strContent.replace(/"/g, """);
strContent = strContent.replace(/(r{0,1})n/g, "nn");
strContent = strContent.replace(/</script>/gi, "</","script>");
var strResult = "<script language=javascript>ndocument.write("n" + strContent + "");n</" + "script>";
form.JSSRC.value = strResult;
return false;
}
function showResult(form, src) {
var wopt = "menubar=yes,toolbar=yes,location=yes,scrollbars=yes,status=yes,resizable=yes";
switch (true) {
case form.size[1].checked: wopt += ",width=640,height=480"; break;
case form.size[2].checked: wopt += ",width=800,height=600"; break;
case form.size[3].checked: wopt += ",width=1024,height=768"; break;
}
winResult = window.open("about:blank","",wopt);
winResult.document.open("text/html", "replace");
switch (src) {
case "html": winResult.document.write(form.HTML.value); break;
case "js": winResult.document.write(form.JSSRC.value); break;
}
winResult.document.close();
return false;
}
</script>
</head>
<body style="margin:0px" onLoad="document.mainform.HTML.focus()">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4" bgColor="lightgrey">
<form name="mainform" onSubmit="return generateSource(this)">
<tr height="20">
<th align="left" colspan="2">▒ HTML-JS 생성기</th>
</tr>
<tr height="10">
<th width="50%">대상 HTML 소스코드</th>
<th width="50%">HTML 출력용 JS 소스코드</th>
</tr>
<tr>
<td width="50%"><textarea name="HTML" style="width:100%;height:100%"></textarea></td>
<td width="50%"><textarea name="JSSRC" readonly style="width:100%;height:100%"></textarea></td>
</tr>
<tr height="20">
<td colspan="2">
<input type="submit" value="JS 소스코드 생성" onClick="this.form.HTML.focus()">
<input type="button" value="HTML 미리보기" onClick="showResult(this.form,'html');this.blur()">
<input type="button" value="JS 실행결과" onClick="showResult(this.form,'js');this.blur()">
결과창 크기:
<input type="radio" name="size" checked>기본
<input type="radio" name="size">640x480
<input type="radio" name="size">800x600
<input type="radio" name="size">1024x768
</td>
</tr>
</form>
</table>
</body>
</html>
제목 | 글쓴이 | 날짜 |
---|---|---|
[PHP 동영상강의] 32. 자료의 정렬순서를 바꿔보자. [8] | 서기 | 2006.01.11 |
[PHP 동영상강의] 31. DB에서 값을 가져와 출력하기 [15] | 서기 | 2006.01.05 |
[PHP 동영상강의] 30. 테이블에 값을 추가해보자 [17] | 서기 | 2006.01.04 |
[PHP 동영상강의] 29. 테이블을 만들어보자! [5] | 서기 | 2006.01.04 |
[PHP 동영상강의] 28. SQL이란, phpmyadmin 설치방법 [5] | 서기 | 2006.01.03 |
[PHP 동영상강의] 27. 기본적인 환경변수들 [4] | 서기 | 2006.01.03 |
채널을 가장 쉽게 하는법 [17] | 미오유 | 2006.01.02 |
[PHP 동영상강의] 26. 쿠키의 시간제한 [2] | 서기 | 2005.12.26 |
PHP 구문 5가지 표기 방식 [6] | 이강민 | 2005.12.23 |
[PHP 동영상강의] 25. 회원가입처리 / 로그인 구현 [6] | 서기 | 2005.12.16 |
[PHP 동영상강의] 24. 쿠키의 사용 [3] | 서기 | 2005.12.13 |
[PHP 동영상강의] 23. 파일을 이용한 간단한 카운터 제작하기 [4] | 서기 | 2005.12.12 |
[PHP 동영상강좌] 22. 다른 사이트의 특정부위만 가져오기 [7] | 서기 | 2005.12.08 |
[PHP 동영상강좌] 21. 파일을 이용한 메모장 만들기 #3 [3] | 서기 | 2005.12.08 |
[PHP 동영상강좌] 20. 파일을 이용한 메모장 만들기 #2 [6] | 서기 | 2005.12.07 |
[PHP 동영상강의] 19. 파일을 이용한 메모장 만들기 #1 [10] | 서기 | 2005.11.29 |
[PHP 동영상강의] 18. 파일의 생성과 사용 [9] | 서기 | 2005.11.28 |
[PHP 동영상강좌] 17. 배열변수의 사용 [9] | 서기 | 2005.11.25 |
[PHP 동영상강좌] 16. for 반복문의 사용 [8] | 서기 | 2005.11.24 |
[PHP 동영상강좌] 15. 여러개의 파일을 이용한 설문조사 [7] | 서기 | 2005.11.23 |
노프레임에서 메뉴들을 js로 생성해놓으면 수정 첨가시 이넘만 고치면 되거든요..^^
불러올땐 <script language="JavaScript" src="js 파일주소"></script>
정말 고맙습니다.