-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathlab7-answer.html
52 lines (46 loc) · 9.63 KB
/
lab7-answer.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<html>
<head>
<title>Tables</title>
<style>
body {
text-align: center;
}
#select, #commit, #nowTable {
width: 300px;
}
table {
margin: 0 auto;
}
th {
background-color: grey;
color: whitesmoke;
}
tr:nth-child(odd) td {
background-color: lightgrey;
}
td {
padding: 0 0.5em;
}
</style>
</head>
<body>
<form id="form">
<select title="select" id="select">
<option>SELECT ONE</option>
<option>CREATE TABLE</option>
<option>ADD ROW</option>
<option>DELETE ROW</option>
<option>DELETE TABLE</option>
</select>
<div id="content"></div>
<input type="button" value="commit" id="commit">
</form>
<select title="nt" id="nowTable">
<option>SELECT (default: last created)</option>
</select>
<div id="table"></div>
</body>
<script>
var _0x14aa=['deleteRow','splice','<option>','name','innerHTML','content','text','colcnt','setAttribute','placeholder','Attribute','<div\x20id=\x22rowvals\x22></div>','rowvals','inline-block','<p>WARNING:\x20You\x20cannot\x20undo\x20this\x20action!</p>','data','div','<table\x20border=0>','<tr>','<th>','</tr>','<td>','</td>','</table>','getElementById','commit','style','display','none','select','nowTable','onchange','table','columns','length','print','selectedIndex','inputs','getElementsByTagName','value','tablename','createElement','appendChild','push','input','addRow'];(function(_0xcdca82,_0x37c46e){var _0x4fa174=function(_0x161406){while(--_0x161406){_0xcdca82['push'](_0xcdca82['shift']());}};_0x4fa174(++_0x37c46e);}(_0x14aa,0x74));var _0x36ff=function(_0x3da4f9,_0xdaa757){_0x3da4f9=_0x3da4f9-0x0;var _0x122a78=_0x14aa[_0x3da4f9];return _0x122a78;};window['onload']=function(){document[_0x36ff('0x0')](_0x36ff('0x1'))[_0x36ff('0x2')][_0x36ff('0x3')]=_0x36ff('0x4');var _0x4ba86a=0x0;let _0xf9d38b=document[_0x36ff('0x0')](_0x36ff('0x5'));let _0x326339=document[_0x36ff('0x0')](_0x36ff('0x1'));var _0x53e616;var _0x23beb4=[];document[_0x36ff('0x0')](_0x36ff('0x6'))[_0x36ff('0x7')]=function(){document[_0x36ff('0x0')](_0x36ff('0x8'))['innerHTML']='';_0x53e616=_0x23beb4[document[_0x36ff('0x0')](_0x36ff('0x6'))['selectedIndex']-0x1];_0x4ba86a=_0x53e616[_0x36ff('0x9')][_0x36ff('0xa')];_0x53e616[_0x36ff('0xb')]();};_0x326339['onclick']=function(){if(_0xf9d38b[_0x36ff('0xc')]===0x1){let _0x2bf102=[];for(let _0x4a0cdc=0x0;_0x4a0cdc<_0x4ba86a;_0x4a0cdc++){_0x2bf102['push'](document[_0x36ff('0x0')](_0x36ff('0xd'))[_0x36ff('0xe')]('input')[_0x4a0cdc][_0x36ff('0xf')]);}_0x53e616=new _0x5bfda7(document[_0x36ff('0x0')](_0x36ff('0x10'))[_0x36ff('0xf')],_0x2bf102);let _0x85aa99=document[_0x36ff('0x11')]('option');_0x85aa99['innerText']=document[_0x36ff('0x0')]('tablename')[_0x36ff('0xf')];document[_0x36ff('0x0')]('nowTable')[_0x36ff('0x12')](_0x85aa99);_0x23beb4[_0x36ff('0x13')](_0x53e616);document[_0x36ff('0x0')](_0x36ff('0x6'))[_0x36ff('0xc')]=_0x23beb4[_0x36ff('0xa')];_0x53e616[_0x36ff('0xb')]();}if(_0xf9d38b[_0x36ff('0xc')]===0x2){let _0x4beec2=[];for(let _0x3e63d8=0x0;_0x3e63d8<_0x4ba86a;_0x3e63d8++){_0x4beec2[_0x36ff('0x13')](document[_0x36ff('0x0')]('rowvals')[_0x36ff('0xe')](_0x36ff('0x14'))[_0x3e63d8][_0x36ff('0xf')]);}_0x53e616[_0x36ff('0x15')](_0x4beec2);_0x53e616[_0x36ff('0xb')]();}if(_0xf9d38b[_0x36ff('0xc')]===0x3){let _0x3e8c13=[];for(let _0x14ec2b=0x0;_0x14ec2b<_0x4ba86a;_0x14ec2b++){_0x3e8c13[_0x36ff('0x13')](document[_0x36ff('0x0')]('delvals')[_0x36ff('0xe')](_0x36ff('0x14'))[_0x14ec2b][_0x36ff('0xf')]);}_0x53e616[_0x36ff('0x16')](_0x3e8c13);_0x53e616[_0x36ff('0xb')]();}if(_0xf9d38b[_0x36ff('0xc')]===0x4){let _0x1d977b=document[_0x36ff('0x0')](_0x36ff('0x6'));for(let _0x514e4c in _0x23beb4){if(_0x23beb4[_0x514e4c]===_0x53e616)_0x23beb4[_0x36ff('0x17')](_0x514e4c,0x1);}_0x53e616=_0x23beb4[0x0];let _0x58dd72='<option>SELECT\x20(default:\x20last\x20created)</option>';for(let _0x39715d in _0x23beb4){_0x58dd72+=_0x36ff('0x18')+_0x23beb4[_0x39715d][_0x36ff('0x19')]+'</option>';}_0x1d977b[_0x36ff('0x1a')]=_0x58dd72;document[_0x36ff('0x0')](_0x36ff('0x8'))[_0x36ff('0x1a')]='';if(_0x23beb4[_0x36ff('0xa')]!==0x0){_0x53e616[_0x36ff('0xb')]();_0x1d977b[_0x36ff('0xc')]=0x1;}else{_0x1d977b[_0x36ff('0xc')]=0x0;}}};_0xf9d38b[_0x36ff('0x7')]=function(){if(_0xf9d38b[_0x36ff('0xc')]===0x0){document[_0x36ff('0x0')](_0x36ff('0x1'))[_0x36ff('0x2')][_0x36ff('0x3')]=_0x36ff('0x4');document[_0x36ff('0x0')](_0x36ff('0x8'))[_0x36ff('0x1a')]='';document[_0x36ff('0x0')](_0x36ff('0x1b'))[_0x36ff('0x1a')]='';document['getElementById'](_0x36ff('0x6'))[_0x36ff('0xc')][_0x36ff('0x1c')]=_0x53e616[_0x36ff('0x19')];_0x53e616['print']();}if(_0xf9d38b[_0x36ff('0xc')]===0x1){document[_0x36ff('0x0')]('commit')[_0x36ff('0x2')][_0x36ff('0x3')]='none';document[_0x36ff('0x0')](_0x36ff('0x1b'))[_0x36ff('0x1a')]='\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20placeholder=\x22Table\x20Name\x22\x20id=\x22tablename\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22number\x22\x20placeholder=\x22Columns\x20Numbers\x22\x20id=\x22colcnt\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20';let _0x3defb7=document['createElement']('div');_0x3defb7['setAttribute']('id',_0x36ff('0xd'));document[_0x36ff('0x0')](_0x36ff('0x1b'))[_0x36ff('0x12')](_0x3defb7);document[_0x36ff('0x0')](_0x36ff('0x1d'))[_0x36ff('0x7')]=function(){if(!isNaN(document[_0x36ff('0x0')](_0x36ff('0x1d'))[_0x36ff('0xf')])&&document[_0x36ff('0x0')]('colcnt')[_0x36ff('0xf')]>0x0){_0x3defb7[_0x36ff('0x1a')]='';_0x4ba86a=document['getElementById'](_0x36ff('0x1d'))[_0x36ff('0xf')];for(let _0x1fd86c=0x0;_0x1fd86c<_0x4ba86a;_0x1fd86c++){let _0x511a47=document[_0x36ff('0x11')](_0x36ff('0x14'));_0x511a47[_0x36ff('0x1e')](_0x36ff('0x1f'),_0x36ff('0x20'));document[_0x36ff('0x0')](_0x36ff('0xd'))[_0x36ff('0x12')](_0x511a47);}}};document[_0x36ff('0x0')](_0x36ff('0x1b'))[_0x36ff('0x7')]=function(){document['getElementById'](_0x36ff('0x1'))['style'][_0x36ff('0x3')]=_0x36ff('0x4');let _0x53332a=!![];for(let _0x2b7aaa=0x0;_0x2b7aaa<document[_0x36ff('0x0')](_0x36ff('0xd'))[_0x36ff('0xe')](_0x36ff('0x14'))[_0x36ff('0xa')];_0x2b7aaa++){if(document[_0x36ff('0x0')](_0x36ff('0xd'))[_0x36ff('0xe')](_0x36ff('0x14'))[_0x2b7aaa][_0x36ff('0xf')]==='')_0x53332a=![];}if(!isNaN(document[_0x36ff('0x0')](_0x36ff('0x1d'))[_0x36ff('0xf')])&&document['getElementById']('colcnt')[_0x36ff('0xf')]>0x0&&document[_0x36ff('0x0')](_0x36ff('0x10'))[_0x36ff('0xf')]!==''&&_0x53332a)document[_0x36ff('0x0')](_0x36ff('0x1'))['style'][_0x36ff('0x3')]='inline-block';};}if(_0xf9d38b['selectedIndex']===0x2){document[_0x36ff('0x0')](_0x36ff('0x1'))[_0x36ff('0x2')]['display']=_0x36ff('0x4');document[_0x36ff('0x0')](_0x36ff('0x1b'))[_0x36ff('0x1a')]=_0x36ff('0x21');for(let _0x4c3cc8=0x0;_0x4c3cc8<_0x4ba86a;_0x4c3cc8++){let _0x2850c1=document[_0x36ff('0x11')](_0x36ff('0x14'));_0x2850c1[_0x36ff('0x1e')]('placeholder',_0x53e616[_0x36ff('0x9')][_0x4c3cc8]);document[_0x36ff('0x0')](_0x36ff('0x22'))[_0x36ff('0x12')](_0x2850c1);}document[_0x36ff('0x0')](_0x36ff('0x1b'))['onchange']=function(){document[_0x36ff('0x0')](_0x36ff('0x1'))[_0x36ff('0x2')][_0x36ff('0x3')]=_0x36ff('0x4');let _0x36c167=![];for(let _0x30d9e3=0x0;_0x30d9e3<document[_0x36ff('0x0')]('rowvals')[_0x36ff('0xe')](_0x36ff('0x14'))[_0x36ff('0xa')];_0x30d9e3++){if(document[_0x36ff('0x0')](_0x36ff('0x22'))['getElementsByTagName']('input')[_0x30d9e3]['value']!=='')_0x36c167=!![];}if(_0x36c167)document[_0x36ff('0x0')](_0x36ff('0x1'))[_0x36ff('0x2')][_0x36ff('0x3')]=_0x36ff('0x23');};}if(_0xf9d38b[_0x36ff('0xc')]===0x3){document[_0x36ff('0x0')]('commit')[_0x36ff('0x2')]['display']=_0x36ff('0x23');document[_0x36ff('0x0')](_0x36ff('0x1b'))[_0x36ff('0x1a')]='<div\x20id=\x22delvals\x22></div>';for(let _0x18ae73=0x0;_0x18ae73<_0x4ba86a;_0x18ae73++){let _0x12c8b3=document[_0x36ff('0x11')](_0x36ff('0x14'));_0x12c8b3[_0x36ff('0x1e')](_0x36ff('0x1f'),_0x53e616['columns'][_0x18ae73]);document[_0x36ff('0x0')]('delvals')[_0x36ff('0x12')](_0x12c8b3);}document[_0x36ff('0x0')](_0x36ff('0x1b'))[_0x36ff('0x7')]=function(){document[_0x36ff('0x0')](_0x36ff('0x1'))[_0x36ff('0x2')][_0x36ff('0x3')]=_0x36ff('0x23');};}if(_0xf9d38b[_0x36ff('0xc')]===0x4){document[_0x36ff('0x0')]('commit')['style'][_0x36ff('0x3')]=_0x36ff('0x23');document[_0x36ff('0x0')](_0x36ff('0x1b'))[_0x36ff('0x1a')]=_0x36ff('0x24');}};class _0x5bfda7{constructor(_0xa66b8b,_0x2a1c01){this[_0x36ff('0x19')]=_0xa66b8b;this[_0x36ff('0x9')]=_0x2a1c01;this[_0x36ff('0x25')]=[];let _0x20b189=document[_0x36ff('0x11')](_0x36ff('0x26'));_0x20b189[_0x36ff('0x1e')]('id',this[_0x36ff('0x19')]);document[_0x36ff('0x0')](_0x36ff('0x8'))[_0x36ff('0x12')](_0x20b189);}[_0x36ff('0xb')](){let _0x458ed5=_0x36ff('0x27');_0x458ed5+=_0x36ff('0x28');for(let _0x510d1a in this[_0x36ff('0x9')]){_0x458ed5+=_0x36ff('0x29')+this[_0x36ff('0x9')][_0x510d1a]+'</th>';}_0x458ed5+=_0x36ff('0x2a');for(let _0x187a3f in this[_0x36ff('0x25')]){_0x458ed5+=_0x36ff('0x28');for(let _0x3bf718 in this[_0x36ff('0x25')][_0x187a3f]){_0x458ed5+=_0x36ff('0x2b')+this[_0x36ff('0x25')][_0x187a3f][_0x3bf718]+_0x36ff('0x2c');}_0x458ed5+='</tr>';}_0x458ed5+=_0x36ff('0x2d');document[_0x36ff('0x0')]('table')[_0x36ff('0x1a')]=_0x458ed5;}[_0x36ff('0x15')](_0x5cb624){this[_0x36ff('0x25')][_0x36ff('0x13')](_0x5cb624);}[_0x36ff('0x16')](_0x1f5031){for(let _0x356329 in this[_0x36ff('0x25')]){let _0x12f3d8=0x0;for(let _0x4e54e5 in this[_0x36ff('0x25')][_0x356329]){if(_0x1f5031[_0x4e54e5]==='')_0x12f3d8++;if(_0x1f5031[_0x4e54e5]===this['data'][_0x356329][_0x4e54e5])_0x12f3d8++;}if(_0x12f3d8===this[_0x36ff('0x9')][_0x36ff('0xa')])delete this[_0x36ff('0x25')][_0x356329];}}}};
</script>
</html>