이런저런 이유로 요 몇일 스킨을 제작중인데요..ㅠ.ㅠ
스크립이...ㅜ.ㅜ 말을 안들어가...
innerHTML 로 테이블과 텍스트 박스 및 셀렉트 박스를 생성후
컨트롤 하려 하는데요.
이상하게 primary_key() 에서
var optionValue = document.create_table['create_field_name['+i+']'].value;
요넘을 못불러오네요..ㅠ.ㅠ
datetype()에서는
document.create_table["create_date_len["+j+"]"].value
요넘은 아주 잘 불러지고 있는데요..ㅠ.ㅠ
그런데 요넘두 primary_key() 요기로 가서 부르면 안오더라구요..ㅜ.ㅠ
뭘 잘못한건지 도저히 알수가없어서 자문을 구합니다..
아래는 소스 입니다.
<style>
.field_title {
height:30px;
color: #FFFFFF;
}
.field_text {
color: #333333;
}
</style>
<script>
var i = 0;
function add_field()
{
oRow0 = document.createElement('tr');
oRow1 = document.createElement('tr');
oCel0 = document.createElement('td');
oCel1 = document.createElement('td');
oCel2 = document.createElement('td');
oCel3 = document.createElement('td');
oCel4 = document.createElement('td');
oCel5 = document.createElement('td');
oRow0.style.textAlign='center';
oRow0.style.height='32';
oRow1.style.textAlign='center';
oCel5.height='1';
oCel5.bgColor='#e3dcd2';
oCel5.colSpan='5';
oCel0.className='cel0';
oCel1.className='cel1';
oCel2.className='cel2';
oCel3.className='cel3';
oCel4.className='cel4';
oCel5.className='cel5';
oRow1.appendChild(oCel5);
oRow0.appendChild(oCel0);
oRow0.appendChild(oCel1);
oRow0.appendChild(oCel2);
oRow0.appendChild(oCel3);
oRow0.appendChild(oCel4);
oRow0.appendChild(oRow1);
oCel0.innerHTML="#"+i;
oCel1.innerHTML="<input type='text' name='create_field_name["+i+"]' style='width:100%; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;' itemname='테이블명' required>";
oCel2.innerHTML="<select name='create_date_type["+i+"]' onChange='datetype(this.value, "+i+")' style='width:100%; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;' itemname='데이터 타입' required><option selected='selected'>DateType</option><option value='int'>INT</option><option value='char'>CHAR</option><option value='varchar'>VARCHAR</option><option value='text'>TEXT</option></select>";
oCel3.innerHTML="<input type='text' name='create_date_len["+i+"]' style='width:100%; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;' itemname='문자길이'>";
oCel4.innerHTML="<select name='create_not_null["+i+"]' style='width:100%; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;' itemname='NULL'><option value='n'>NOT NULL</option><option value='y' selected='selected'>NULL</option></select>";
oCel5.innerHTML="";
document.getElementById('table_field').children(0).appendChild(oRow0);
document.create_table.field_count.value=i;
i++;
}
function del_field()
{
var tbody = document.getElementById('table_field');
if(tbody.rows.length > 4) {
tbody.deleteRow(tbody.rows.length-2);
i--;
document.create_table.field_count.value=i;
}else{
alert("최소 1개이상의 Field 가 있어야 합니다.");
}
}
function primary_key()
{
var p_count = document.create_table.field_count.value;
var key_count = document.create_table.create_primary_key.length;
for(i=0; i==p_count; i++)
{
var optionValue = document.create_table['create_field_name['+i+']'].value;
if(!optionValue)
{
alert("#"+i+"번 Field Name 이 존재 하지 않습니다.");
}else{
for (d=0; d < key_count; d++){
document.create_table.create_primary_key.options.remove(0);
}
var newItem = new Option;
newItem.text = optionValue;
newItem.value = optionValue;
document.create_table.create_primary_key.options[document.create_table.create_primary_key.length]=newItem;
}
}
}
function datetype(type, j_no)
{
var j = j_no;
var type = type;
var date_type_len = "int-4^char-8^varchar-80^text-65535";
var date_type = date_type_len.split("^");
for(f=0; f<date_type.length; f++)
{
var date_len = date_type[f].split("-");
if(date_len[0] == type)
{
document.create_table["create_date_len["+j+"]"].value = date_len[1];
}
}
}
</script>
<body onLoad="add_field()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class='ht'>
<td align=left><?=subtitle("Db 생성")?></td>
</tr>
<tr>
<td class=line1>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<form name="create_table" method="post" action="<?=$g4['admin_path']?>/create_table_update.php">
<input name="field_count" type="hidden" value=0><input name="field_namelist" type="hidden" value="Primary Key 를 선택해주세요">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center">Table Name</td>
<td>
<input type="text" name="create_table_name" style="width:300px; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;" itemname="Table Name" required>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">Date Field 추가</td>
</tr>
<tr>
<td height="5" align="center"></td>
</tr>
<tr>
<td align="center"><span onClick="add_field();" style="cursor:pointer;">+</span> <span onClick="del_field();" style="cursor:pointer;">-</span></td>
</tr>
</table></td>
<td>
<table border="0" id="table_field" cellspacing="1" cellpadding="0">
<tr>
<td width="50" align="center" bgcolor="#CBB08D" class="field_title">NO</td>
<td width="200" align="center" bgcolor="#CBB08D" class="field_title">Field Name</td>
<td width="180" align="center" bgcolor="#CBB08D" class="field_title">Date Type</td>
<td width="100" align="center" bgcolor="#CBB08D" class="field_title">Date length</td>
<td width="120" align="center" bgcolor="#CBB08D" class="field_title">NULL</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center">PRIMARY KEY</td>
<td>
<select name="create_primary_key" onFocus="primary_key()" style="width:160px; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;" itemname="PRIMARY KEY" required>
<option selected>Primary Key</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class=line1>
</td>
</tr>
<tr>
<td align="right"><input type="submit" name="button" id="button" value="Table 생성" /></td>
</tr>
<tr>
<td> </td>
</tr>
</form>
</table>
</td>
</tr>
</table>
스크립이...ㅜ.ㅜ 말을 안들어가...
innerHTML 로 테이블과 텍스트 박스 및 셀렉트 박스를 생성후
컨트롤 하려 하는데요.
이상하게 primary_key() 에서
var optionValue = document.create_table['create_field_name['+i+']'].value;
요넘을 못불러오네요..ㅠ.ㅠ
datetype()에서는
document.create_table["create_date_len["+j+"]"].value
요넘은 아주 잘 불러지고 있는데요..ㅠ.ㅠ
그런데 요넘두 primary_key() 요기로 가서 부르면 안오더라구요..ㅜ.ㅠ
뭘 잘못한건지 도저히 알수가없어서 자문을 구합니다..
아래는 소스 입니다.
<style>
.field_title {
height:30px;
color: #FFFFFF;
}
.field_text {
color: #333333;
}
</style>
<script>
var i = 0;
function add_field()
{
oRow0 = document.createElement('tr');
oRow1 = document.createElement('tr');
oCel0 = document.createElement('td');
oCel1 = document.createElement('td');
oCel2 = document.createElement('td');
oCel3 = document.createElement('td');
oCel4 = document.createElement('td');
oCel5 = document.createElement('td');
oRow0.style.textAlign='center';
oRow0.style.height='32';
oRow1.style.textAlign='center';
oCel5.height='1';
oCel5.bgColor='#e3dcd2';
oCel5.colSpan='5';
oCel0.className='cel0';
oCel1.className='cel1';
oCel2.className='cel2';
oCel3.className='cel3';
oCel4.className='cel4';
oCel5.className='cel5';
oRow1.appendChild(oCel5);
oRow0.appendChild(oCel0);
oRow0.appendChild(oCel1);
oRow0.appendChild(oCel2);
oRow0.appendChild(oCel3);
oRow0.appendChild(oCel4);
oRow0.appendChild(oRow1);
oCel0.innerHTML="#"+i;
oCel1.innerHTML="<input type='text' name='create_field_name["+i+"]' style='width:100%; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;' itemname='테이블명' required>";
oCel2.innerHTML="<select name='create_date_type["+i+"]' onChange='datetype(this.value, "+i+")' style='width:100%; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;' itemname='데이터 타입' required><option selected='selected'>DateType</option><option value='int'>INT</option><option value='char'>CHAR</option><option value='varchar'>VARCHAR</option><option value='text'>TEXT</option></select>";
oCel3.innerHTML="<input type='text' name='create_date_len["+i+"]' style='width:100%; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;' itemname='문자길이'>";
oCel4.innerHTML="<select name='create_not_null["+i+"]' style='width:100%; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;' itemname='NULL'><option value='n'>NOT NULL</option><option value='y' selected='selected'>NULL</option></select>";
oCel5.innerHTML="";
document.getElementById('table_field').children(0).appendChild(oRow0);
document.create_table.field_count.value=i;
i++;
}
function del_field()
{
var tbody = document.getElementById('table_field');
if(tbody.rows.length > 4) {
tbody.deleteRow(tbody.rows.length-2);
i--;
document.create_table.field_count.value=i;
}else{
alert("최소 1개이상의 Field 가 있어야 합니다.");
}
}
function primary_key()
{
var p_count = document.create_table.field_count.value;
var key_count = document.create_table.create_primary_key.length;
for(i=0; i==p_count; i++)
{
var optionValue = document.create_table['create_field_name['+i+']'].value;
if(!optionValue)
{
alert("#"+i+"번 Field Name 이 존재 하지 않습니다.");
}else{
for (d=0; d < key_count; d++){
document.create_table.create_primary_key.options.remove(0);
}
var newItem = new Option;
newItem.text = optionValue;
newItem.value = optionValue;
document.create_table.create_primary_key.options[document.create_table.create_primary_key.length]=newItem;
}
}
}
function datetype(type, j_no)
{
var j = j_no;
var type = type;
var date_type_len = "int-4^char-8^varchar-80^text-65535";
var date_type = date_type_len.split("^");
for(f=0; f<date_type.length; f++)
{
var date_len = date_type[f].split("-");
if(date_len[0] == type)
{
document.create_table["create_date_len["+j+"]"].value = date_len[1];
}
}
}
</script>
<body onLoad="add_field()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class='ht'>
<td align=left><?=subtitle("Db 생성")?></td>
</tr>
<tr>
<td class=line1>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<form name="create_table" method="post" action="<?=$g4['admin_path']?>/create_table_update.php">
<input name="field_count" type="hidden" value=0><input name="field_namelist" type="hidden" value="Primary Key 를 선택해주세요">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center">Table Name</td>
<td>
<input type="text" name="create_table_name" style="width:300px; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;" itemname="Table Name" required>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">Date Field 추가</td>
</tr>
<tr>
<td height="5" align="center"></td>
</tr>
<tr>
<td align="center"><span onClick="add_field();" style="cursor:pointer;">+</span> <span onClick="del_field();" style="cursor:pointer;">-</span></td>
</tr>
</table></td>
<td>
<table border="0" id="table_field" cellspacing="1" cellpadding="0">
<tr>
<td width="50" align="center" bgcolor="#CBB08D" class="field_title">NO</td>
<td width="200" align="center" bgcolor="#CBB08D" class="field_title">Field Name</td>
<td width="180" align="center" bgcolor="#CBB08D" class="field_title">Date Type</td>
<td width="100" align="center" bgcolor="#CBB08D" class="field_title">Date length</td>
<td width="120" align="center" bgcolor="#CBB08D" class="field_title">NULL</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center">PRIMARY KEY</td>
<td>
<select name="create_primary_key" onFocus="primary_key()" style="width:160px; background-color:#f6f6f6; border:1px solid #d8d8d5; height:21px;" itemname="PRIMARY KEY" required>
<option selected>Primary Key</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class=line1>
</td>
</tr>
<tr>
<td align="right"><input type="submit" name="button" id="button" value="Table 생성" /></td>
</tr>
<tr>
<td> </td>
</tr>
</form>
</table>
</td>
</tr>
</table>
댓글 2개
17년 전
for문이 잘못된것 같은데요..
for(i=0; i<=p_count; i++)
이처럼 작성해야 할것 같습니다..
그럼 optionValue는 잡아 내는데..
오타이신것 같네요.. ㅎㅎ
for(i=0; i<=p_count; i++)
이처럼 작성해야 할것 같습니다..
그럼 optionValue는 잡아 내는데..
오타이신것 같네요.. ㅎㅎ
17년 전
오타
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1430 | 18년 전 | 2978 | ||
| 1429 | 18년 전 | 2923 | ||
| 1428 | 18년 전 | 2818 | ||
| 1427 | 18년 전 | 2129 | ||
| 1426 |
|
18년 전 | 2310 | |
| 1425 |
|
18년 전 | 2865 | |
| 1424 |
|
18년 전 | 2957 | |
| 1423 |
frotone
|
18년 전 | 4123 | |
| 1422 | 18년 전 | 6114 | ||
| 1421 | 18년 전 | 2048 | ||
| 1420 | 18년 전 | 2178 | ||
| 1419 | 18년 전 | 1887 | ||
| 1418 | 18년 전 | 1651 | ||
| 1417 | 18년 전 | 2632 | ||
| 1416 | 18년 전 | 1692 | ||
| 1415 | 18년 전 | 1559 | ||
| 1414 | 18년 전 | 4736 | ||
| 1413 | 18년 전 | 1787 | ||
| 1412 | 18년 전 | 1834 | ||
| 1411 | 18년 전 | 1843 | ||
| 1410 | 18년 전 | 1968 | ||
| 1409 | 18년 전 | 3626 | ||
| 1408 | 18년 전 | 1648 | ||
| 1407 | 18년 전 | 1519 | ||
| 1406 | 18년 전 | 1350 | ||
| 1405 | 18년 전 | 1853 | ||
| 1404 | 18년 전 | 1899 | ||
| 1403 |
frotone
|
18년 전 | 3645 | |
| 1402 | 18년 전 | 1975 | ||
| 1401 | 18년 전 | 3107 | ||
| 1400 | 18년 전 | 4727 | ||
| 1399 | 18년 전 | 2860 | ||
| 1398 | 18년 전 | 8044 | ||
| 1397 | 18년 전 | 4055 | ||
| 1396 |
|
18년 전 | 2738 | |
| 1395 | 18년 전 | 1520 | ||
| 1394 | 18년 전 | 2620 | ||
| 1393 | 18년 전 | 5036 | ||
| 1392 | 18년 전 | 5218 | ||
| 1391 |
cncafe
|
18년 전 | 2089 | |
| 1390 |
mixdesign
|
18년 전 | 4348 | |
| 1389 | 18년 전 | 4090 | ||
| 1388 |
mixdesign
|
18년 전 | 4141 | |
| 1387 | 18년 전 | 2261 | ||
| 1386 | 18년 전 | 4183 | ||
| 1385 |
mixdesign
|
18년 전 | 2169 | |
| 1384 | 18년 전 | 3277 | ||
| 1383 | 18년 전 | 4911 | ||
| 1382 | 18년 전 | 1946 | ||
| 1381 |
오디세우스
|
18년 전 | 3404 | |
| 1380 |
mixdesign
|
18년 전 | 1635 | |
| 1379 | 18년 전 | 2732 | ||
| 1378 |
mixdesign
|
18년 전 | 1659 | |
| 1377 | 18년 전 | 2707 | ||
| 1376 |
|
18년 전 | 2549 | |
| 1375 |
|
18년 전 | 1550 | |
| 1374 |
|
18년 전 | 1489 | |
| 1373 |
|
18년 전 | 1734 | |
| 1372 | 18년 전 | 2236 | ||
| 1371 | 18년 전 | 2014 | ||
| 1370 | 18년 전 | 2376 | ||
| 1369 | 18년 전 | 4913 | ||
| 1368 |
mixdesign
|
18년 전 | 1815 | |
| 1367 | 18년 전 | 1257 | ||
| 1366 | 18년 전 | 1376 | ||
| 1365 | 18년 전 | 1332 | ||
| 1364 | 18년 전 | 1077 | ||
| 1363 | 18년 전 | 1075 | ||
| 1362 | 18년 전 | 1404 | ||
| 1361 | 18년 전 | 1357 | ||
| 1360 | 18년 전 | 2346 | ||
| 1359 | 18년 전 | 1224 | ||
| 1358 | 18년 전 | 1606 | ||
| 1357 | 18년 전 | 2091 | ||
| 1356 | 18년 전 | 1273 | ||
| 1355 | 18년 전 | 2826 | ||
| 1354 | 18년 전 | 1270 | ||
| 1353 | 18년 전 | 1646 | ||
| 1352 | 18년 전 | 1497 | ||
| 1351 | 18년 전 | 1448 | ||
| 1350 | 18년 전 | 1233 | ||
| 1349 | 18년 전 | 1076 | ||
| 1348 | 18년 전 | 1664 | ||
| 1347 | 18년 전 | 1102 | ||
| 1346 | 18년 전 | 3614 | ||
| 1345 | 18년 전 | 1708 | ||
| 1344 |
mixdesign
|
18년 전 | 1788 | |
| 1343 | 18년 전 | 1115 | ||
| 1342 | 18년 전 | 1849 | ||
| 1341 | 18년 전 | 1093 | ||
| 1340 | 18년 전 | 1163 | ||
| 1339 | 18년 전 | 1013 | ||
| 1338 | 18년 전 | 1002 | ||
| 1337 | 18년 전 | 1094 | ||
| 1336 |
|
18년 전 | 2575 | |
| 1335 | 18년 전 | 1544 | ||
| 1334 | 18년 전 | 1636 | ||
| 1333 | 18년 전 | 1203 | ||
| 1332 | 18년 전 | 1872 | ||
| 1331 | 18년 전 | 1517 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기