본문 바로가기

🎧️ 강의듣기

jQuery-ui accordion / datepicker / dialog

accordion01.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Accordion - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
	$( function() {
		$( "#accordion" ).accordion({
			collapsible: true
		});
		
		$( '#btn1' ).button().on('click', function(){
			let html = '';	
			html += '<h3>Section 1</h3>';
			html += '<div>';
			html += '<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sitamet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo utodio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.';
			html += '</p>';
			html += '</div>';
			
			$( "#accordion" ).append( html );
			$( "#accordion" ).accordion( 'refresh' );
		});
	});
  </script>
</head>
<body>
<button id="btn1">데이터 추가</button>
<br /><hr /><br />
<div id="accordion">
	<h3>Section 1</h3>
	<div>
		<p>
			Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
			ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
			amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
			odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
		</p>
	</div>
	
	<h3>Section 2</h3>
	
	<div>
		<p>
			Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
			purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
			velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
			suscipit faucibus urna.
		</p>
	</div>
	
	<h3>Section 3</h3>
	
	<div>
		<p>
			Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
			Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
			ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
			lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
		</p>
		
		<ul>
			<li>List item one</li>
			<li>List item two</li>
			<li>List item three</li>
		</ul>
	</div>
	
	<h3>Section 4</h3>
	
	<div>
		<p>
			Cras dictum. Pellentesque habitant morbi tristique senectus et netus
			et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
			faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
			mauris vel est.
		</p>
		<p>
			Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
			Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
			inceptos himenaeos.
		</p>
	</div>
</div>
 
 
</body>
</html>

 

 

accordion02.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Accordion - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
	$( function() {
		var icons = {
				header: "ui-icon-circle-arrow-e",
				activeHeader: "ui-icon-circle-arrow-s"
		};
		$( '#accordion' ).accordion({
			icons: icons
		});
		$( '#toggle' ).button().on('click', function(){
			if( $('#accordion' ).accordion( 'option', 'icons' ) ){
				$( 'accordion' ).accordion( 'option', 'icons', null );
			} else {
				$( 'accordion' ).accordion( 'option', 'icons', icons );
			}
		});
	});
  </script>
</head>
<body>
	<div id="accordion">
	
		<h3>Section 1</h3>
		
		<div>
			<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
		</div>
		
		<h3>Section 2</h3>
		
		<div>
			<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
		</div>
		
		<h3>Section 3</h3>
		
		<div>
			<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
		<ul>
			<li>List item one</li>
			<li>List item two</li>
			<li>List item three</li>
		</ul>
		
		</div>
		
		<h3>Section 4</h3>
		
		<div>
			<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
		</div>
	</div>
	 
	<button id="toggle">Toggle icons</button>
</body>
</html>

 

accordion03.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Accordion - Fill space</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  #accordion-resizer {
    padding: 10px;
    width: 350px;
    height: 220px;
  }
  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#accordion" ).accordion({
      heightStyle: "fill"
    });
 
    $( "#accordion-resizer" ).resizable({
      minHeight: 140,
      minWidth: 200,
      resize: function() {
        $( "#accordion" ).accordion( "refresh" );
      }
    });
  } );
  </script>
</head>
<body>
 
<h3 class="docs">Resize the outer container:</h3>
 
<div id="accordion-resizer" class="ui-widget-content">
  <div id="accordion">
    <h3>Section 1</h3>
    <div>
      <p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
    </div>
    <h3>Section 2</h3>
    <div>
      <p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
    </div>
    <h3>Section 3</h3>
    <div>
      <p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
      <ul>
        <li>List item one</li>
        <li>List item two</li>
        <li>List item three</li>
      </ul>
    </div>
    <h3>Section 4</h3>
    <div>
      <p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
    </div>
  </div>
</div>
 
 
</body>
</html>

 

gugudan.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
	$( function() {
		let html = '';
		$( "#accordion" ).accordion({
			collapsible: true
		});
		$('#startDan').spinner({
			value: 1,
			min: 1,
			max: 8,
			spin: function( event, ui){
				$('#endDan').spinner( 'value', ui.value+1 );
			}
		});
		
		$('#endDan').spinner({
			value: 2,
			min: 2,
			max: 9
		});
		
		$('#btn').button().on('click', () => {
			html = '';
			for(let i = $('#startDan').val(); i <= $('#endDan').val(); i++){
				html += '<h3>' + i + '단</h3>';
				html += '<div>';
				for(let j = 1; j <= 9; j++){
					html += '<p>' + i + ' * ' + j + ' = ' + i * j + '</p>';
				}
				html += '</div>';
			}
			$('#accordion').html(html);
			$('#accordion').accordion({
				heightStyle: "fill",
			});
			$('#accordion').accordion('refresh');
			
		});
		
	});
  </script>
</head>
<body>
<label for="startDan">시작 단:</label>
<input id="startDan" name="startDan" readonly="readonly" /> -
<label for="endDan">끝 단:</label>
<input id="endDan" name="endDan" readonly="readonly" />
<button id="btn">구구단 출력</button>
<br /><hr /><br />
<div id="accordion">

</div>
</body>
</html>

TTS ( Text to Speech )

STT (Speech to Text )

            - 머신러닝

 

datepicker01.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="../css/base/jquery-ui.css" />
		<script type="text/javascript" src="../js/jquery-3.6.0.min.js"></script>
		<script type="text/javascript" src="../js/jquery-ui.js"></script>
		<script type="text/javascript">
		$( () => {
			$( '#datepicker1' ).datepicker({
				numberOfMonths: 3,
				showButtonPanel: true
			});
		});
		</script>
	</head>
<body>
	Date : <input type="text" id="datepicker1" readonly="readonly" /><br />
	Date : <input type="date" /><br />
</body>
</html>

 

datepicker02.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
		<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
		<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
		<script type="text/javascript">
		$( () => {
			$( '#datepicker' ).datepicker();
			$( '#format' ).on( 'change', function(){
				$( '#datepicker' ).datepicker( 'option', 'dateFormat', $( this ).val() );
			});
		});
		</script>
	</head>
<body>
	<p>Date: <input type="text" id="datepicker" size="30" /> </p>
	
	<p></p>Format options:<br />
	<select id="format">
		<option value="mm/dd/yy">Default - mm/dd/yy</option>
		<option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option>
		<option value="d M, y">Short - d M, y</option>
		<option value="d MM, y">Medium - d MM, y</option>
		<option value="DD, d MM, yy">full - DD, d MM, yy</option>
		<option value="&apos;day&apos; d &apos;of&apos; MM &apos;in the year&apos; yy">With text - &apos;day&apos; d &apos;of&apos; MM &apos;in the year&apos; yy</option>
	</select>
</body>
</html>

 

dialog01.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="../css/base/jquery-ui.css" />
		<script type="text/javascript" src="../js/jquery-3.6.0.min.js"></script>
		<script type="text/javascript" src="../js/jquery-ui.js"></script>
		<script type="text/javascript">
		$( () => {
			$( '#dialog' ).dialog({
				// autoOpen :자동적으로 띄우기 X
				autoOpen: false,
				modal: true,
				resizable: false,
				width: 500,
				height: 300,
				buttons: {
					'취소': function() {
						$( this ).dialog( 'close' );
					},
					'확인': function() {
						alert( '확인' );
						$( this ).dialog( 'close' );
					}
				},
				show: {
					effect: 'blind',
					duration: 1000
				},
				hide: {
					effect: 'explode',
					duration: 1000
				}
			});
			$( '#btn1').on('click', () => {
				$( '#dialog' ).dialog( 'open' );
			});
			$( '#btn2').on('click', () => {
				$( '#dialog' ).dialog( 'close' );
			});
		});
		</script>
	</head>
<body>
	<button id="btn1">열기</button>
	<button id="btn2">닫기</button>
	<div id="dialog" title="jQuery Dialog">
	<h1>Hello jQuery</h1>
	</div>
</body>
</html>

 

dialog02.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="../css/base/jquery-ui.css" />
		<style type="text/css">
			label, input { display:block; }
		    input.text { margin-bottom:12px; width:95%; padding: .4em; }
		    fieldset { padding:0; border:0; margin-top:25px; }
		    h1 { font-size: 1.2em; margin: .6em 0; }
		    div#users-contain { width: 350px; margin: 20px 0; }
		    div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		    div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
		    .ui-dialog .ui-state-error { padding: .3em; }
		    .validateTips { border: 1px solid transparent; padding: 0.3em; }
		</style>
		<script type="text/javascript" src="../js/jquery-3.6.0.min.js"></script>
		<script type="text/javascript" src="../js/jquery-ui.js"></script>
		<script type="text/javascript">
		$( () => {
			$( '#dialog-form' ).dialog({
				autoOpen: false,
				modal: true,
				width: 350,
				height: 400,
				resizable: false,
				buttons: {
					'취소': function(){
						$( this ).dialog( 'close' );
					},
					'확인': function(){
						let html = '';
						html += '<tr>';
							html += '<td>' + $( '#name' ).val() + '</td>';
							html += '<td>' + $( '#email' ).val() + '</td>';
							html += '<td>' + $( '#password' ).val() + '</td>';
						html += '</tr>';
						$( '#users tbody' ).append( html );
						
						$( this ).dialog( 'close' );
					}
				}
			});
			$( '#btn').button().on('click', () => {
				$( '#dialog-form' ).dialog( 'open' );
			});
		});
		</script>
	</head>
<body>
	<button id="btn">열기</button>
	
	<div id="dialog-form" title="Create new user">
		<p class="validateTips">All form fields are required.</p>
		 
		<form>
			<fieldset>
				<label for="name">Name</label>
				<input type="text" name="name" id="name" value="Jane Smith" class="text ui-widget-content ui-corner-all">
				<label for="email">Email</label>
				<input type="text" name="email" id="email" value="jane@smith.com" class="text ui-widget-content ui-corner-all">
				<label for="password">Password</label>
				<input type="password" name="password" id="password" value="xxxxxxx" class="text ui-widget-content ui-corner-all">
				 
				<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
			</fieldset>
		</form>
	</div>
	<div id="users-contain" class="ui-widget">
  <h1>Existing Users:</h1>
  <table id="users" class="ui-widget ui-widget-content">
    <thead>
      <tr class="ui-widget-header ">
        <th>Name</th>
        <th>Email</th>
        <th>Password</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John Doe</td>
        <td>john.doe@example.com</td>
        <td>johndoe1</td>
      </tr>
    </tbody>
  </table>
</div>
</body>
</html>

 

 

'🎧️ 강의듣기' 카테고리의 다른 글

이클립스 Spring 설정하기  (0) 2021.08.05
Java를 위한 프레임 워크 mybatis  (0) 2021.08.02
jquery-ui  (0) 2021.07.14
jQuery 문법  (0) 2021.07.13
ajax(websocket) jQuery 사용법  (0) 2021.07.12