<html> <head> </head> <script language="javascript" > var ee = function ( x , y ){ return x + y; };
/* 아래처럼 함수를 선언하면 엔진에서 자동으로 ee2 = function ee2( x , y , i ) 와 같이 변경을 해준다 함. 그래서 아래처럼 재귀적 호출 방식으로 사용할 경우 정상 동작을 함. */ var ee2 = function ( x , y , i ){ if( i == 3 ) return x; return ee2( x + y , y , i + 1 ); }; var div_a1; function init(){ console.log( 'aa'); console.log( 'value: '+ ee( 3 , 4 ) );
console.log( 'value: '+ ee2( 3 , 4 , 0 ) );
} </script> <body onload="init();" >
</body> </html> |
'자바스크립트'에 해당되는 글 19건
- 2018.05.05 함수 표현식으로 선언할때 자동으로 함수명 변경.
- 2017.09.14 [extJs] 헤더(컬럼) 동적으로 추가하기
- 2017.09.13 include , 포함인지 여부
- 2017.09.11 [jqGrid] 특정 셀 마우스다운하고 다른 셀에 마우스 업하면 값 이동
- 2017.09.08 [jqGrid] simple Grid (local)
- 2017.09.08 [extJs] Mouse down the cell value and put it in the mouse-up cell
- 2017.09.08 onClick onFocus eventListener
- 2017.09.08 [extJs] simple grid (editable)
- 2017.09.08 날짜 초 분 더하기 빼기
- 2017.09.07 div 회전
뷰포트를 이용해야 하는듯.
그리드를 처음에 만들어서 뷰포트에 넣어서 나오게 만들고
버튼을 클릭하면 뷰포트에서 지운다음 그리드를 다시 만들어서
뷰포트에 넣는 구조.
<html> <head> </head> <link rel="stylesheet" type="text/css" charset="UTF-8" href="./theme-gray-all.css" /> <style type="text/css"> </style> <script type="text/javascript" charset="UTF-8" src="./ext-all.js"></script> <body> <script language='javascript' > var val_click; Ext.onReady(function(){ columns = [ { text: 'Name', width: 100, sortable: false, hideable: false, dataIndex: 'name' }, { text: 'Email Address', width: 150, dataIndex: 'email', hidden: false }, { text: 'Phone Number', flex: 1, dataIndex: 'phone' , editable: true } ]; Ext.define('User', { extend: 'Ext.data.Model', fields: columns }); var userStore = Ext.create('Ext.data.Store', { model: 'User', data: [ { name: 'Lisa', email: 'lisa@simpsons.com', phone: '100' , age: '50' }, { name: 'Bart', email: 'bart@simpsons.com', phone: '110' , age: '20'}, { name: 'Homer', email: 'homer@simpsons.com', phone: '31', age: '10' }, { name: 'Marge', email: 'marge@simpsons.com', phone: '95', age: '30' } ] }); gridConfig = { store: userStore, width: 400, height: 200, title: 'Application Users', editable : true, columns : Ext.Array.clone( columns ) }; grid01 = Ext.create('Ext.grid.Panel', gridConfig ); button1 = Ext.create('Ext.Button', { text: 'Click me', handler: function() { viewport.remove(grid01, true); columns.push( { text: 'age', flex: 1, dataIndex: 'age' , editable: true } ); gridConfig.columns = columns; grid01 = Ext.create('Ext.grid.Panel', gridConfig ); viewport.add(grid01); } }); var viewport = Ext.create('Ext.container.Viewport', { layout: 'border', items: [ grid01 , button1 ] }); }); </script> </body> </html> |
'[.js][software]' 카테고리의 다른 글
[realGrid] sort 기능 막기 (0) | 2018.10.14 |
---|---|
[realGrid] 기타 (0) | 2018.09.14 |
[jqGrid] div를 이용한 퍼센테이지바 percentage bar (0) | 2017.09.11 |
[jqGrid] jqGrid 틀고정 Fixed frame (0) | 2017.09.11 |
[jqGrid] 특정 셀 마우스다운하고 다른 셀에 마우스 업하면 값 이동 (0) | 2017.09.11 |
어떤 변수에 "aaa" 라는 값이 포함 되어 있는지
아닌지를 찾을때 ..
방법
찾은게 .. include 인데..
이건 ..
익스플로러 12 이상에서만 가능하다고 함.
indexOf 로 찾을수 있습니다.~
아래 결과는 ddd 의 시작 위치를 리턴.
없는 경우 찾는 값이 없는 경우 -1 리턴.
익스 버전 상관 없이 가능한 함수.
<!DOCTYPE html> <html> <head> </head> <script language='javascript' > function test( ){ console.log( '--- '); var a = 'sef ccc ddd ddd '; console.log( ' --- ' + a.indexOf("ddd") ); }
test(); </script> <body> </body> </html> |
'[.js] no category' 카테고리의 다른 글
base html 왁구 (0) | 2019.08.03 |
---|---|
1초에 한번 함수 실행 (0) | 2017.09.06 |
정수로 casting 예제 (0) | 2017.09.06 |
/* 특정 셀 값을 다른 셀로 마우스로 이동 */
/* 마우스다운한 위치의 값을 마우스업한 위치로 이동 */
/* Move mouse-down to the position where you mouse-up */
/* Move a specific cell value to another cell */
<html> <head> </head> <link rel="stylesheet" type="text/css" media="screen" href="./jqueryUi/jquery-ui.css" /> <link rel="stylesheet" type="text/css" media="screen" href="./jqGrid/css/ui.jqgrid.css" /> <style type="text/css"> </style> <script src="./jqGrid/js/jquery-3.2.1.min.js"></script> <script src="./jqueryUi/jquery-ui.js"></script> <script src="./jqGrid/js/jquery.jqGrid.min.js"></script> <script language='javascript' > var value1 = ''; $(function(){ var gridData = [ {seq:"1",date1:"2017/09/01",name1:"Homer",name2:"note",hitnum:"100"}, {seq:"2",date1:"2017/10/02",name1:"Marge",name2:"note2",hitnum:"350"} ]; $("#list").jqGrid({ datatype: "local", height: 300, colNames:['seq','name1', 'name2', 'date','hit'], colModel:[ {name:'seq'}, {name:'name1'}, {name:'name2'}, {name:'date1'}, {name:'hitnum'} ], caption: " title aa ", gridComplete: function() { $('.jqgrow').mousedown(function(e) { var rowId = $(this).attr('id'); var colModel = jQuery("#list").jqGrid ('getGridParam', 'colModel'); var name1 = colModel[e.target.cellIndex].name; value1 = $('#list').jqGrid('getCell', rowId, name1 ); }); $('.jqgrow').mouseup(function(e) { var rowId = $(this).attr('id'); var colModel = jQuery("#list").jqGrid ('getGridParam', 'colModel'); var name1 = colModel[e.target.cellIndex].name; $("#list").jqGrid('setCell',rowId, name1 , value1 ); }); $('#list').on("selectstart", function(event){ return false; }); $('#list').on("dragstart", function(event){ return false; }); } }); for(var i=0;i<=gridData.length;i++){ $("#list").jqGrid('addRowData',i+1,gridData[i]); } }) </script> <body> <table id="list"></table> </body> </html> |
'[.js][software]' 카테고리의 다른 글
[jqGrid] div를 이용한 퍼센테이지바 percentage bar (0) | 2017.09.11 |
---|---|
[jqGrid] jqGrid 틀고정 Fixed frame (0) | 2017.09.11 |
[jqGrid] simple Grid (local) (0) | 2017.09.08 |
[extJs] Mouse down the cell value and put it in the mouse-up cell (0) | 2017.09.08 |
[extJs] simple grid (editable) (0) | 2017.09.08 |
/* 기본 그리드 형태 */ /* base grid style */ <html> <head> </head> <link rel="stylesheet" type="text/css" media="screen" href="./jqueryUi/jquery-ui.css" /> <link rel="stylesheet" type="text/css" media="screen" href="./jqGrid/css/ui.jqgrid.css" /> <style type="text/css"> </style> <script src="./jqGrid/js/jquery-3.2.1.min.js"></script><script src="./jqueryUi/jquery-ui.js"></script> <script src="./jqGrid/js/jquery.jqGrid.min.js"></script> <script language='javascript' > $(function(){ var gridData = [ {seq:"1",date1:"2017/09/01",name1:"Homer",name2:"note",hitnum:"100"}, {seq:"2",date1:"2017/10/02",name1:"Marge",name2:"note2",hitnum:"350"} ]; $("#list").jqGrid({ datatype: "local", height: 300, colNames:['seq','name1', 'name2', 'date','hit'], colModel:[ {name:'seq'}, {name:'name1'}, {name:'name2'}, {name:'date1'}, {name:'hitnum'} ], caption: " title aa " }); for(var i=0;i<=gridData.length;i++){ $("#list").jqGrid('addRowData',i+1,gridData[i]); } }) </script> <body> <table id="list"></table> </body> </html> |
'[.js][software]' 카테고리의 다른 글
[jqGrid] jqGrid 틀고정 Fixed frame (0) | 2017.09.11 |
---|---|
[jqGrid] 특정 셀 마우스다운하고 다른 셀에 마우스 업하면 값 이동 (0) | 2017.09.11 |
[extJs] Mouse down the cell value and put it in the mouse-up cell (0) | 2017.09.08 |
[extJs] simple grid (editable) (0) | 2017.09.08 |
[extJs] simple gird (0) | 2017.09.08 |
/* Mouse down the cell value and put it in the mouse-up cell */ /* 그리드에서 마우스다운한 셀 값 가져다(드레그 해서) 마우스업한 셀에 넣기 */ <html> <head> </head> <link rel="stylesheet" type="text/css" charset="UTF-8" href="./theme-gray-all.css" /> <style type="text/css"> </style> <script type="text/javascript" charset="UTF-8" src="./ext-all.js"></script> <body> <script language='javascript' > var val_click; Ext.onReady(function(){ Ext.define('User', { extend: 'Ext.data.Model', fields: [ 'name', 'email', 'phone' ] }); var userStore = Ext.create('Ext.data.Store', { model: 'User', data: [ { name: 'Lisa', email: 'lisa@simpsons.com', phone: '555-111-1221' }, { name: 'Bart', email: 'bart@simpsons.com', phone: '555-222-1232' }, { name: 'Homer', email: 'homer@simpsons.com', phone: '555-222-1243' }, { name: 'Marge', email: 'marge@simpsons.com', phone: '555-222-1254' } ] }); Ext.create('Ext.grid.Panel', { renderTo: document.body, store: userStore, width: 400, height: 200, title: 'Application Users', editable : true, columns: [ { text: 'Name', width: 100, sortable: false, hideable: false, dataIndex: 'name' }, { text: 'Email Address', width: 150, dataIndex: 'email', hidden: true }, { text: 'Phone Number', flex: 1, dataIndex: 'phone' , editable: true } ] , listeners: { 'cellmousedown': function(iView, iCellEl, iColIdx, iStore, iRowEl, iRowIdx, iEvent) { var rec = this.getStore().getAt(iRowIdx); var val2 = this.columns[iColIdx].dataIndex; val_click = rec.get( val2 ); console.log(' value :: ' + val_click ); }, 'cellmouseup': function(iView, iCellEl, iColIdx, iStore, iRowEl, iRowIdx, iEvent) { var rec = this.getStore().getAt(iRowIdx); var val2 = this.columns[iColIdx].dataIndex; rec.set( val2 , val_click ); } } }); }); </script> <title>Simple Grid Sample for ExtJs</title> </body> </html> |
'[.js][software]' 카테고리의 다른 글
[jqGrid] 특정 셀 마우스다운하고 다른 셀에 마우스 업하면 값 이동 (0) | 2017.09.11 |
---|---|
[jqGrid] simple Grid (local) (0) | 2017.09.08 |
[extJs] simple grid (editable) (0) | 2017.09.08 |
[extJs] simple gird (0) | 2017.09.08 |
[extJs] 텍스트 필드에 값 붙여 넣으면 읽어서 치환. (0) | 2017.09.07 |
<html> <head> </head> <script language="javascript" > function init(){ var hoy1 = document.getElementById('hoy'); //인풋박스안에 클릭을 했다가 다른곳 클릭을 해야 //실행되는 이벤트 리스너. // An event listener that is executed after // clicking in the input box and clicking elsewhere. hoy1.addEventListener("blur", func1 , false);
//포커스만 되도 실행되는 리스너 //A listener that will be executed even if the focus is reached hoy1.addEventListener("focus", func2 , false); } function func1(){ console.log( ' hoy 1'); } function func2(){ console.log( ' hoy 2'); } </script> <body onload="init();" > <input type='text' size='20' id='hoy' > </body> </html> |
'[.js] 이벤트' 카테고리의 다른 글
붙여넣기 이벤트 처리 ctrl+v (0) | 2017.09.06 |
---|---|
div 에다가 클릭 이벤트 걸기 (0) | 2017.09.06 |
<html> <head> </head> <link rel="stylesheet" type="text/css" charset="UTF-8" href="./theme-gray-all.css" /> <style type="text/css"> </style> <script type="text/javascript" charset="UTF-8" src="./ext-all.js"></script> <body> <script language='javascript' > Ext.onReady(function(){ Ext.define('User', { extend: 'Ext.data.Model', fields: [ 'name', 'email', 'phone' ] }); var userStore = Ext.create('Ext.data.Store', { model: 'User', data: [ { name: 'Lisa', email: 'lisa@simpsons.com', phone: '555-111-1224' }, { name: 'Bart', email: 'bart@simpsons.com', phone: '555-222-1234' }, { name: 'Homer', email: 'homer@simpsons.com', phone: '555-222-1244' }, { name: 'Marge', email: 'marge@simpsons.com', phone: '555-222-1254' } ] }); Ext.create('Ext.grid.Panel', { renderTo: document.body, store: userStore, width: 400, height: 200, title: 'Application Users', editable : true, columns: [ { text: 'Name', width: 100, sortable: false, hideable: false, dataIndex: 'name' }, { text: 'Email Address', width: 150, dataIndex: 'email', hidden: true }, { text: 'Phone Number', flex: 1, dataIndex: 'phone', editor: { xtype:'textfield', allowBlank:false }, editable: true } ], plugins: [ Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }) ] }); }); </script> <title>Simple Grid Sample for ExtJs</title> </body> </html> |
'[.js][software]' 카테고리의 다른 글
[jqGrid] 특정 셀 마우스다운하고 다른 셀에 마우스 업하면 값 이동 (0) | 2017.09.11 |
---|---|
[jqGrid] simple Grid (local) (0) | 2017.09.08 |
[extJs] Mouse down the cell value and put it in the mouse-up cell (0) | 2017.09.08 |
[extJs] simple gird (0) | 2017.09.08 |
[extJs] 텍스트 필드에 값 붙여 넣으면 읽어서 치환. (0) | 2017.09.07 |
<html> <head> </head> <script language="javascript" > function init(){ var today = new Date(); today.setDate(today.getDate() + 30); //Date after 30 days var year = today.getFullYear(); var month = today.getMonth() + 1; var day = today.getDate(); var min = ''; var sec = ''; console.log( year + '-' + month + '-' + day ); today = new Date(); today.setDate(today.getDate() - 30); // Date before 30 days year = today.getFullYear(); month = today.getMonth() + 1; day = today.getDate(); console.log( year + '-' + month + '-' + day );
today = new Date(); today.setMinutes(today.getMinutes() + 30); //After 30 minutes year = today.getFullYear(); month = today.getMonth() + 1; day = today.getDate(); min = today.getMinutes(); console.log( year + '-' + month + '-' + day + '-' + min ); today = new Date(); year = today.getFullYear(); month = today.getMonth() + 1; day = today.getDate(); min = today.getMinutes(); sec = today.getSeconds(); console.log( year + '-' + month + '-' + day + '-' + min + '-' + sec );
today = new Date(); year = today.getFullYear(); month = today.getMonth() + 1; min = today.getMinutes(); sec = today.setSeconds( today.getSeconds() + 500 ); //After 500 seconds sec = today.getSeconds(); console.log( year + '-' + month + '-' + day + '-' + min + '-' + sec ); } </script> <body onload="init();" > <div id="groundDiv" style="position:relative;"></div> <div id='a1' style="position:absolute;" ></div> <input type='text' size='20' > </body> </html>
|
'[.js] 날짜' 카테고리의 다른 글
날짜 빼기 , 11개월전 날짜 구하기 (0) | 2018.11.21 |
---|---|
현재날짜 YYYYMMDDHHMMSS (0) | 2018.10.05 |
현재 날짜 구하기 (0) | 2017.09.06 |
이달의 마지막날짜 구하기 (0) | 2017.09.06 |
<html>
<head>
</head>
<script language="javascript" >
/*
rotate the div(a1)
*/
var div_a1;
function init(){
div_a1 = document.getElementById('a1');
aa = setInterval("rotate_div()", 50); // 1000 = 1초 1초마다 roofing_func 를 실행하라.~
}
var aa = 0;
function rotate_div(){
//div_a1.style.left = e.offsetX - 20 + 'px';
//div_a1.style.top = e.offsetY - 20 + 'px';
aa += 1;
if( aa > 360 )
aa = 0;
div_a1.style.webkitTransform = 'rotate(' + aa + 'deg)';
}
</script>
<body onload="init();" >
<div id="groundDiv" style="position:relative; width:99%; height:99%; border:0x solid black;"></div>
<div id='a1' style="position:absolute; width:3px; height:50px; border:2px solid black;top:100px;left:100px " ></div>
</body>
</html>
'[.js] div 의 이동' 카테고리의 다른 글
클릭 드레그 하면 따라다니는 div (0) | 2017.09.07 |
---|---|
한 점을 기준으로 + 를 회전시킴 (0) | 2017.09.06 |
click 누르면 div를 생성해서 특정 위치에 위치시킨다. (0) | 2017.09.06 |