셀렉트 문의드립니다.
본문
그누보드 4를 사용 하고 있는 유저입니다.
월은 wr_7, 일은 wr_8로 구분해 놓은 상태입니다. 화면상에는
위와 같이 표현이 되고 있습니다.
여기서 문제입니다. 글을 작성하려고 글쓰기 버튼을 누를때 자동으로 금일 월과 일이 자동으로 선택되게 하려면 어떻게 해야될까요? 조심스럽게 고수님들께 여쭈어봅니다.
======================================================================
<td class=write_head>방문날짜 <font color="red">(*)</font></td>
<td>
<select name=ca_name itemname="분류"><option value="">2016년</select>
<select class="ed" name="wr_7" itemname='<?=$board[bo_7_subj]?>' required value="<?=$write[wr_7]?>">
<?
if ($write[wr_7]){
echo "<option selected value='$write[wr_7]'>$write[wr_7]</option>";
} else {
echo "<option selected value=''>월</option>";
}
echo "$bo_7_option";
?>
</select>
<select class="ed" name="wr_8" itemname='<?=$board[bo_8_subj]?>' required value="<?=$write[wr_8]?>">
<?
if ($write[wr_8]){
echo "<option selected value='$write[wr_8]'>$write[wr_8]</option>";
} else {
echo "<option selected value=''>일</option>";
}
echo "$bo_8_option";
?>
</select>
<select class="ed" name="wr_10" itemname='<?=$board[bo_9_subj]?>' required value="<?=$write[wr_10]?>">
<?
if ($write[wr_10]){
echo "<option selected value='$write[wr_10]'>$write[wr_10]</option>";
} else {
echo "<option selected value=''>시간</option>";
}
echo "$bo_9_option";
?>
</select></td>
</tr>
답변 9
<script>
// 파일 하단에 삽입
var f = document.fwrite;
if (!'<?=$write[wr_7]?>') f.wr_7.value = '<?=date('m')?>월';
if (!'<?=$write[wr_8]?>') f.wr_8.value = '<?=date('d')?>일';
</script>
현재 실제 월이 1~12월까지 일은 1~31일까지 정상적으로 나오고 있나요?
실제 작동하는 페이지를 보고 싶네요
$bo_8_option 이미 이 변수를 먼저 알려 주세요.
어떻게 되어 있는지 봐야 할 것 같네요.
<script type="text/javascript">
var dt = new Date();
var zeroFill = "0";
var m = (zeroFill + (dt.getMonth() + 1)).slice(-2) + "월";
var d = (zeroFill + dt.getDate()).slice(-2) + "일";
$(function() {
if(!$("input[name='w']").val()) {
$("select[name='wr_7']").val(m);
$("select[name='wr_8']").val(d);
}
});
</script>
이걸 넣어 보세요.
날짜에 0이랑 월, 일이 붙어서...
php는 함수는 조건을 줘야 하겠더군요.
저 두 가지 때문에 함수를 수정할 순 없고 그냥 javascript로 처리하시는 게 더 나을 듯하네요.
!-->list.skin.php 파일입니다.
=====================================
<script language="JavaScript">
var page,wid,hit,nam;
function win(page,nam,wid,hit)
{
var windo = eval('window.open("'+page+'","'+nam+'","status=no,toolbar=no,resizable=no,scrollbars=no,menubar=no,width='+wid+',height='+hit+',top=100,left=350")');
}
</script>
</head>
<body>
<body oncontextmenu = "return false"
ondragstart = "return false"
onselectstart = "return false">
</body>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($w == "u") {
$memo_body_1 = explode("|",substr($write[memo_1], 1));
$memo_body_2 = explode("|",substr($write[memo_2], 1));
$memo_body_3 = explode("|",substr($write[memo_3], 1));
}
//카테고리 ca_name
$arr = explode("|", $board[bo_category_list]); // 구분자가 | 로 되어 있음
$str = "";
for ($i=0; $i<count($arr); $i++){
if (trim($arr[$i]))
$categorys .= "<option value='$arr[$i]'>$arr[$i]</option>\n";
}
$arrayf = explode("|",$board[bo_category_list]);
$arrays1 = explode("|",$board[bo_10]);
if($w=="u"){
for($i=0; $i<count($arrayf); $i++){
if($ca_name==$arrayf[$i]){
$tu = $i+1;
}
}
}
function get_bo_n_option($bo_n='')
{
global $g4, $board;
$arr = explode("|", $board[$bo_n]); // 구분자가 | 로 되어 있음
$str = "";
for ($i=0; $i<count($arr); $i++)
if (trim($arr[$i]))
$str .= "<option value='$arr[$i]'>$arr[$i]</option>\n";
return $str;
}
// 2단계 분류 사용
if ($is_category = true) {
$bo_6_option = get_bo_n_option('bo_6'); // SELECT OPTION 태그로 넘겨받음
$bo_7_option = get_bo_n_option('bo_7'); // SELECT OPTION 태그로 넘겨받음
$bo_8_option = get_bo_n_option('bo_8'); // SELECT OPTION 태그로 넘겨받음
$bo_9_option = get_bo_n_option('bo_9'); // SELECT OPTION 태그로 넘겨받음
$bo_10_option = get_bo_n_option('bo_10'); // SELECT OPTION 태그로 넘겨받음
}
if ($is_dhtml_editor) {
include_once("$g4[path]/lib/cheditor.lib.php");
echo "<script src='$g4[editor_path]/cheditor.js'></script>";
echo cheditor1('wr_content', $content);
}
?>
<script>
function addRow() {
var oRow = dyntbl1.insertRow();
oRow.onmouseover=function(){dyntbl1.clickedRowIndex=this.rowIndex};
var oCell1 = oRow.insertCell();
var oCell2 = oRow.insertCell();
oCell1.innerHTML = "<input class=ed style='width:100%;' required name=memo_body_1[] itemname='내용'>";
oCell2.innerHTML = "<input type=button value=\" 삭제 \" onClick=\"delRow()\">";
document.recalc();
}
function delRow() {
dyntbl1.deleteRow(dyntbl1.clickedRowIndex);
}
function delRow_php(r)
{
var i=r.parentNode.parentNode.rowIndex;
document.getElementById('dyntbl2').deleteRow(i);
}
function fixscreen() {
var buffer = document.all.item(0).outerHTML;
document.open("text/html", "replace");
document.write(buffer);
document.close();
}
function addCol() {
var vCell,tmp;
for (var i=0; i<dyntbl1.rows.length; i++) {
tmp=dyntbl1.rows[i].cells[dyntbl1.rows[i].cells.length-1].cloneNode(true);
dyntbl1.rows[i].deleteCell();
vCell=dyntbl1.rows[i].insertCell();
vCell.innerHTML=i==0?"<input type=button value=' X ' onclick='delCol(parentNode.cellIndex)'>":" ";
vCell=dyntbl1.rows[i].insertCell();
vCell.innerHTML=tmp.innerHTML;
}
}
function delCol(idx) {
for (var i=0; i<=dyntbl1.rows.length; i++) {
dyntbl1.rows[i].cells[idx].removeNode();
}
}
</script>
<script language="javascript">
// 글자수 제한
var char_min = parseInt(<?=$write_min?>); // 최소
var char_max = parseInt(<?=$write_max?>); // 최대
</script>
<script language="JavaScript">
// 이메일 자동입력
<!--
function checkemailaddy(){
if (fwrite.email_select.value == '1') {
fwrite.email2.readOnly = false;
fwrite.email2.value = '';
fwrite.email2.focus();
}
else {
fwrite.email2.readOnly = true;
fwrite.email2.value = fwrite.email_select.value;
}
}
//-->
</script>
<script>
//전화번호 자동 하이픈적용
<!--
function OnCheckPhone(oTa) {
var oForm = oTa.form ;
var sMsg = oTa.value ;
var onlynum = "" ;
onlynum = RemoveDash2(sMsg);
if(event.keyCode != 8 ) {
if (GetMsgLen(onlynum) <= 2) oTa.value = onlynum ;
if (GetMsgLen(onlynum) == 3) oTa.value = onlynum + "-";
if (GetMsgLen(onlynum) == 4) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,4) ;
if (GetMsgLen(onlynum) == 5) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,5) ;
if (GetMsgLen(onlynum) == 6) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,6) ;
if (GetMsgLen(onlynum) == 7) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,7) ;
if (GetMsgLen(onlynum) == 8) oTa.value = onlynum.substring(0,4) + "-" + onlynum.substring(4,8) ;
if (GetMsgLen(onlynum) == 9) oTa.value = onlynum.substring(0,4) + "-" + onlynum.substring(4,9) ;
}
}
function RemoveDash2(sNo) {
var reNo = ""
for(var i=0; i<sNo.length; i++) {
if ( sNo.charAt(i) != "-" ) {
reNo += sNo.charAt(i)
}
}
return reNo
}
function GetMsgLen(sMsg) { // 0-127 1byte, 128~ 2byte
var count = 0
for(var i=0; i<sMsg.length; i++) {
if ( sMsg.charCodeAt(i) > 127 ) {
count += 2
}
else {
count++
}
}
return count
}
//-->
</script>
<style type="text/css">
.form_title{font-family:돋움;font-weight:bold;font-size:12px;color:#0042ff;pading-left:10px;}
.form_help{font-family:돋움;font-size:12px;color:#ff6600;}
.write_head { text-align:right; color:#8492A0; }
.field { border:1px solid #ccc; }
</style>
<link rel='stylesheet' type='text/css' href='<?=$board_skin_path?>/mstyle.css'> <!-- //ssh -->
<form name="fwrite" method="post" action="javascript:fwrite_check(document.fwrite);" enctype="multipart/form-data" style="margin:0px;">
<input type=hidden name=null>
<input type=hidden name=w value="<?=$w?>">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=wr_id value="<?=$wr_id?>">
<input type=hidden name=sca value="<?=$sca?>">
<input type=hidden name=sfl value="<?=$sfl?>">
<input type=hidden name=stx value="<?=$stx?>">
<input type=hidden name=spt value="<?=$spt?>">
<input type=hidden name=sst value="<?=$sst?>">
<input type=hidden name=sod value="<?=$sod?>">
<input type=hidden name=page value="<?=$page?>">
<input type="hidden" name=wr_name value="이름">
<input type=hidden maxlength=100 size=50 name=wr_content itemname="내용" value="<?=$content?>">
<input type=hidden name=set_name id="set_name" itemname="작성자" value="<?=$member[mb_name]?>">
<table width="<?=$width?>" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="70%" valign="top"><div style="border:1px solid #ddd; background-color:#6289BB; height:34px;">
<div style="font-weight:bold; font-size:14px; margin:7px 0 0 10px;"><font style='font-family:돋움; font-size:11pt; font-weight:bold; color:#ffffff;'><?=$subject?> 방문객 정보
<font size=2 color="red">(*) </font><font size=2>는 필수입력 사항 입니다.</font></font></div>
</div>
<div style="height:3px; background:url(<?=$board_skin_path?>/img/title_shadow.gif) repeat-x; line-height:1px; font-size:1px;"></div>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<colgroup width=120>
<colgroup width=''>
<tr>
<td class=write_head>공장선택 <font color="red">(*)</font></td>
<td>
<label><input type="radio" name="wr_29" id="wr_29" value="평택" <?php if(htmlspecialchars($write[wr_29],ENT_QUOTES) == "평택" || !$write[wr_29]) echo "checked"; ?>> 평택 </label>
<label><input type="radio" name="wr_29" id="wr_29" value="아산" <?php if(htmlspecialchars($write[wr_29],ENT_QUOTES) == "아산") echo "checked"; ?>> 아산 </label>
</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>방문장소 <font color="red">(*)</font></td>
<td>
<label><input type="radio" name="wr_30" id="wr_30" value="사무실" <?php if(htmlspecialchars($write[wr_30],ENT_QUOTES) == "사무실" || !$write[wr_30]) echo "checked"; ?>> 사무실 </label>
<label><input type="radio" name="wr_30" id="wr_30" value="현장" <?php if(htmlspecialchars($write[wr_30],ENT_QUOTES) == "현장") echo "checked"; ?>> 현장 </label>
</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>방문자명 <font color="red">(*)</font></td>
<td>
<input class=ed style="width:200px;" name=wr_subject required itemname="방문자명" value="<?=$subject?>"/><font color="gray"> (000, 000, 000 형태로 입력해주세요)</font></td>
</tr>
<td class=write_head>방문날짜 <font color="red">(*)</font></td>
<td>
<select name=ca_name itemname="분류"><option value="">2016년</select>
<select class="ed" name="wr_7" itemname='<?=$board[bo_7_subj]?>' required value="<?=$write[wr_7]?>">
<?
if ($write[wr_7]){
echo "<option selected value='$write[wr_7]'>$write[wr_7]</option>";
} else {
echo "<option selected value=''>월</option>";
}
echo "$bo_7_option";
?>
</select>
<select class="ed" name="wr_8" itemname='<?=$board[bo_8_subj]?>' required value="<?=$write[wr_8]?>">
<?
if ($write[wr_8]){
echo "<option selected value='$write[wr_8]'>$write[wr_8]</option>";
} else {
echo "<option selected value=''>일</option>";
}
echo "$bo_8_option";
?>
</select>
<select class="ed" name="wr_10" itemname='<?=$board[bo_9_subj]?>' required value="<?=$write[wr_10]?>">
<?
if ($write[wr_10]){
echo "<option selected value='$write[wr_10]'>$write[wr_10]</option>";
} else {
echo "<option selected value=''>시간</option>";
}
echo "$bo_9_option";
?>
</select></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>핸드폰 <font color="red">(*)</font></td>
<td><select class=box name='wr_11' itemname='휴대전화국번'>
<option value='010' <? if($write[wr_11] == "010") echo "selected"; ?>>010</option>
<option value='011' <? if($write[wr_11] == "011") echo "selected"; ?>>011</option>
<option value='016' <? if($write[wr_11] == "016") echo "selected"; ?>>016</option>
<option value='017' <? if($write[wr_11] == "017") echo "selected"; ?>>017</option>
<option value='018' <? if($write[wr_11] == "018") echo "selected"; ?>>018</option>
<option value='019' <? if($write[wr_11] == "019") echo "selected"; ?>>019</option>
</select>
-
<input name='wr_12' required value='<?=$write[wr_12]?>' type='text' onfocus="OnCheckPhone(this)" onKeyup="OnCheckPhone(this)" size=10 itemname='핸드폰 뒷번호' class=input /></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>회사전화 </td>
<td><select name='wr_13' itemname='전화번호'>
<option value='033' <? if($write[wr_13] == "033") echo "selected"; ?>>033</option>
<option value='02' <? if($write[wr_13] == "02") echo "selected"; ?>>02</option>
<option value='031' <? if($write[wr_13] == "031") echo "selected"; ?>>031</option>
<option value='032' <? if($write[wr_13] == "032") echo "selected"; ?>>032</option>
<option value='041' <? if($write[wr_13] == "041") echo "selected"; ?>>041</option>
<option value='042' <? if($write[wr_13] == "042") echo "selected"; ?>>042</option>
<option value='043' <? if($write[wr_13] == "043") echo "selected"; ?>>043</option>
<option value='051' <? if($write[wr_13] == "051") echo "selected"; ?>>051</option>
<option value='052' <? if($write[wr_13] == "052") echo "selected"; ?>>052</option>
<option value='053' <? if($write[wr_13] == "053") echo "selected"; ?>>053</option>
<option value='054' <? if($write[wr_13] == "054") echo "selected"; ?>>054</option>
<option value='055' <? if($write[wr_13] == "055") echo "selected"; ?>>055</option>
<option value='061' <? if($write[wr_13] == "061") echo "selected"; ?>>061</option>
<option value='062' <? if($write[wr_13] == "062") echo "selected"; ?>>062</option>
<option value='063' <? if($write[wr_13] == "063") echo "selected"; ?>>063</option>
<option value='064' <? if($write[wr_13] == "064") echo "selected"; ?>>064</option>
</select>
-
<input name='wr_14' value='<?=$write[wr_14]?>' type='text' onfocus="OnCheckPhone(this)" onKeyup="OnCheckPhone(this)" size=10 itemname='회사전화 뒷번호' class=input></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>이메일 </td>
<td><table width="116" border="0" cellspacing="1" cellpadding="1">
<tr>
<td><input class=ed style="ime-mode:inactive; width:80px;" name=wr_15 type="text" id="email1" size="15" itemname='이메일' value="<?=$write[wr_15]?>"></td>
<td>@</td>
<td><select name="email_select" class="box" id="email_select" onChange="checkemailaddy();">
<option value="" selected>선택</option>
<option value="daum.net">다음</option>
<option value="naver.com">네이버</option>
<option value="empal.com">엠파스</option>
<option value="yahoo.co.kr">야후</option>
<option value="dreamwiz.com">드림위즈</option>
<option value="hotmail.com">핫메일</option>
<option value="chollian.net">천리안</option>
<option value="freechal.com">프리챌</option>
<option value="hanafos.com">하나포스</option>
<option value="korea.com">코리아</option>
<option value="lycos.co.kr">라이코스</option>
<option value="netian.com">네티앙</option>
<option value="netsgo.com">넷츠고</option>
<option value="unitel.co.kr">유니텔</option>
<option value="1">직접입력</option>
</select></td>
<td><input style="ime-mode:inactive; width:100px;" name="wr_27" type="text" class=ed id="email2" size="20" itemname='이메일주소' value="<?=$write[wr_27]?>"></td>
</tr>
</table></td>
</tr>
<tr>
<td class=write_head>소속회사명칭 <font color="red">(*)</font></td>
<td><input class=ed type='text' style="width:275px;" name=wr_40 required size=4 itemname='소속회사명칭' value="<?=$write[wr_40]?>"></td>
</tr>
<tr>
<td class=write_head>생년월일 </td>
<td><input class=ed style="width:90px;" name=wr_4 itemname="생년월일" value="<?=$write[wr_4]?>" /><font color="gray"> (YYYY-MM-DD 형태로 입력해주세요)</font></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>차량번호 </td>
<td><input class=ed style="width:90px;" name=wr_3 itemname="차량번호" value="<?=$write[wr_3]?>" /><font color="gray"> (00가0000 형태로 입력해주세요)</font></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>노트북 반입여부 <font color="red">(*)</font></td>
<td>
<label><input type="radio" name="wr_39" id="wr_39" value="O" <?php if(htmlspecialchars($write[wr_39],ENT_QUOTES) == "O") echo "checked"; ?>> O </label>
<label><input type="radio" name="wr_39" id="wr_39" value="X" <?php if(htmlspecialchars($write[wr_39],ENT_QUOTES) == "X" || !$write[wr_39]) echo "checked"; ?>> X </label>
</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>노트북 사용목적 </td>
<td><input class=ed style="width:275px;" name=wr_18 itemname="부서" value="<?=$write[wr_18]?>" /></td>
</tr>
<table width="<?=$width?>" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="70%" valign="top"><div style="border:1px solid #ddd; background-color:#6289BB; height:34px;">
<div style="font-weight:bold; font-size:14px; margin:7px 0 0 10px;"><font style='font-family:돋움; font-size:11pt; font-weight:bold; color:#ffffff;'> 신청자 정보
</font></div>
</div>
<div style="height:3px; background:url(<?=$board_skin_path?>/img/title_shadow.gif) repeat-x; line-height:1px; font-size:1px;"></div>
<table width="100%" border="0" cellpadding="1" cellspacing="3">
<colgroup width=120>
<colgroup width=''>
<tr>
<td class=write_head>부 서 <font color="red">(*)</font></td>
<td><input class=ed style="width:100px;" name=wr_20 required itemname="부서" value="<?=$write[wr_20]?>" /></td>
<td class=write_head>
<strong>방문정보</strong>
</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>이 름 <font color="red">(*)</font></td>
<td><input class=ed style="width:100px;" name=wr_47 required itemname="이름" value="<?=$write[wr_47]?>" itemname='핸드폰 두번째자리' class=input />
<script language="javascript">
function day(){
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
document.getElementById("wr_44").value = h+":"+m
}
</script>
<td class="write_head">
<input type="button" value="방문" onclick="day()" tabindex="-1" >
<input class="ed" style="width:50px;" id="wr_44" name="wr_44" itemname="복귀" value="<?=$write[wr_44]?>" itemname='핸드폰 두번째자리' class="input" tabindex="-1" />
</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>직통전화 <font color="red">(*)</font></td>
<td><select name='wr_23' itemname='회사 전화 국번'>
<option value='031' <? if($write[wr_23] == "031") echo "selected"; ?>>031</option>
<option value='041' <? if($write[wr_23] == "041") echo "selected"; ?>>041</option>
</select>
-
<input name='wr_24' value='<?=$write[wr_24]?>' required type='text' onfocus="OnCheckPhone(this)" onKeyup="OnCheckPhone(this)" size=10 itemname='회사전화 번호' class=input></td>
<script language="javascript">
function day2(){
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
document.getElementById("wr_45").value = h+":"+m
}
</script>
<td class="write_head">
<input type="button" value="복귀" onclick="day2()" tabindex="-1" >
<input class="ed" style="width:50px;" id="wr_45" name="wr_45" itemname="복귀" value="<?=$write[wr_45]?>" itemname='핸드폰 두번째자리' class="input" tabindex="-1" />
</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<tr>
<td class=write_head>핸드폰 </td>
<td><select name='wr_25' itemname='회사 팩스 국번'>
<option value='010' <? if($write[wr_25] == "010") echo "selected"; ?>>010</option>
<option value='011' <? if($write[wr_25] == "011") echo "selected"; ?>>011</option>
<option value='019' <? if($write[wr_25] == "019") echo "selected"; ?>>019</option>
<option value='016' <? if($write[wr_25] == "016") echo "selected"; ?>>016</option>
</select>
-
<input name='wr_26' value='<?=$write[wr_26]?>' type='text' onfocus="OnCheckPhone(this)" onKeyup="OnCheckPhone(this)" size=10 itemname='핸드폰 두번째자리' class=input></td>
<body onload="javascript:pop2(); javascript:pop()">
<script language="javascript">
function day3(){
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
document.getElementById("wr_44").value ="미방문"
document.getElementById("wr_45").value ="미방문"
}
</script>
<td class="write_head">
<input type="button" value="미방문" onclick="day3()" style="width:90px; tabindex="-1" >
</td>
</tr>
</body>
</tr>
</table>
<tr>
<td width="100%" align="center" valign="top">
<input type=image id="btn_submit" src="<?=$board_skin_path?>/img/btn_write2.gif" border=0 accesskey='s'>
<a href="./board.php?bo_table=<?=$bo_table?>"><img id="btn_list" src="<?=$board_skin_path?>/img/btn_list2.gif" border=0></a>
<br>
</td>
</td>
</tr>
</table>
</form>
<script type="text/javascript"> var md5_norobot_key = ''; </script>
<script type="text/javascript" src="<?="$g4[path]/js/prototype.js"?>"></script>
<script type="text/javascript">
function imageClick() {
var url = "<?=$g4[bbs_path]?>/kcaptcha_session.php";
var para = "";
var myAjax = new Ajax.Request(
url,
{
method: 'post',
asynchronous: true,
parameters: para,
onComplete: imageClickResult
});
}
function imageClickResult(req) {
var result = req.responseText;
var img = document.createElement("IMG");
img.setAttribute("src", "<?=$g4[bbs_path]?>/kcaptcha_image.php?t=" + (new Date).getTime());
document.getElementById('kcaptcha_image').src = img.getAttribute('src');
md5_norobot_key = result;
}
<? if (!$is_member) { ?>Event.observe(window, "load", imageClick);<? } ?>
</script>
<script language="javascript">
<?
// 관리자라면 분류 선택에 '공지' 옵션을 추가함
if ($is_admin)
{
echo "
if (typeof(document.fwrite.ca_name) != 'undefined')
{
document.fwrite.ca_name.options.length += 1;
document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].value = '공지';
document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].text = '공지';
}";
}
?>
with (document.fwrite) {
if (typeof(wr_name) != "undefined")
wr_name.focus();
else if (typeof(wr_subject) != "undefined")
wr_subject.focus();
else if (typeof(wr_content) != "undefined")
wr_content.focus();
if (typeof(ca_name) != "undefined")
if (w.value == "u")
ca_name.value = "<?=$write[ca_name]?>";
}
function html_auto_br(obj) {
if (obj.checked) {
result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
if (result)
obj.value = "html2";
else
obj.value = "html1";
}
else
obj.value = "";
}
function fwrite_check(f) {
var s = "";
if (s = word_filter_check(f.wr_subject.value)) {
alert("제목에 금지단어('"+s+"')가 포함되어있습니다");
return;
}
if (s = word_filter_check(f.wr_content.value)) {
alert("내용에 금지단어('"+s+"')가 포함되어있습니다");
return;
}
if (document.getElementById('char_count')) {
if (char_min > 0 || char_max > 0) {
var cnt = parseInt(document.getElementById('char_count').innerHTML);
if (char_min > 0 && char_min > cnt) {
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
return;
}
else if (char_max > 0 && char_max < cnt) {
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return;
}
}
}
if (typeof(f.wr_key) != "undefined") {
if (hex_md5(f.wr_key.value) != md5_norobot_key) {
alert("자동등록방지용 빨간글자가 순서대로 입력되지 않았습니다.");
f.wr_key.focus();
return;
}
}
document.getElementById('btn_submit').disabled = true;
document.getElementById('btn_list').disabled = true;
<?
if ($g4[https_url])
echo "f.action = '$g4[https_url]/$g4[bbs]/write_update.php';";
else
echo "f.action = './write_update.php';";
?>
f.submit();
}
</script>
<script language="JavaScript" src="<?="$g4[path]/js/board.js"?>"></script>
<? if ($is_dhtml_editor) {?><script language="JavaScript" src="<?="$g4[path]/geditor/geditor.js"?>"></script><?}?>
<script language="JavaScript">
window.onload=function() {
drawFont();
}
</script>
=====================================
다음은 write.skin.php 파일입니다.
=====================================
<script language="JavaScript">
var page,wid,hit,nam;
function win(page,nam,wid,hit)
{
var windo = eval('window.open("'+page+'","'+nam+'","status=no,toolbar=no,resizable=no,scrollbars=no,menubar=no,width='+wid+',height='+hit+',top=100,left=350")');
}
</script>
</head>
<body>
<body oncontextmenu = "return false"
ondragstart = "return false"
onselectstart = "return false">
</body>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($w == "u") {
$memo_body_1 = explode("|",substr($write[memo_1], 1));
$memo_body_2 = explode("|",substr($write[memo_2], 1));
$memo_body_3 = explode("|",substr($write[memo_3], 1));
}
//카테고리 ca_name
$arr = explode("|", $board[bo_category_list]); // 구분자가 | 로 되어 있음
$str = "";
for ($i=0; $i<count($arr); $i++){
if (trim($arr[$i]))
$categorys .= "<option value='$arr[$i]'>$arr[$i]</option>\n";
}
$arrayf = explode("|",$board[bo_category_list]);
$arrays1 = explode("|",$board[bo_10]);
if($w=="u"){
for($i=0; $i<count($arrayf); $i++){
if($ca_name==$arrayf[$i]){
$tu = $i+1;
}
}
}
function get_bo_n_option($bo_n='')
{
global $g4, $board;
$arr = explode("|", $board[$bo_n]); // 구분자가 | 로 되어 있음
$str = "";
for ($i=0; $i<count($arr); $i++)
if (trim($arr[$i]))
$str .= "<option value='$arr[$i]'>$arr[$i]</option>\n";
return $str;
}
// 2단계 분류 사용
if ($is_category = true) {
$bo_6_option = get_bo_n_option('bo_6'); // SELECT OPTION 태그로 넘겨받음
$bo_7_option = get_bo_n_option('bo_7'); // SELECT OPTION 태그로 넘겨받음
$bo_8_option = get_bo_n_option('bo_8'); // SELECT OPTION 태그로 넘겨받음
$bo_9_option = get_bo_n_option('bo_9'); // SELECT OPTION 태그로 넘겨받음
$bo_10_option = get_bo_n_option('bo_10'); // SELECT OPTION 태그로 넘겨받음
}
if ($is_dhtml_editor) {
include_once("$g4[path]/lib/cheditor.lib.php");
echo "<script src='$g4[editor_path]/cheditor.js'></script>";
echo cheditor1('wr_content', $content);
}
?>
<script>
function addRow() {
var oRow = dyntbl1.insertRow();
oRow.onmouseover=function(){dyntbl1.clickedRowIndex=this.rowIndex};
var oCell1 = oRow.insertCell();
var oCell2 = oRow.insertCell();
oCell1.innerHTML = "<input class=ed style='width:100%;' required name=memo_body_1[] itemname='내용'>";
oCell2.innerHTML = "<input type=button value=\" 삭제 \" onClick=\"delRow()\">";
document.recalc();
}
function delRow() {
dyntbl1.deleteRow(dyntbl1.clickedRowIndex);
}
function delRow_php(r)
{
var i=r.parentNode.parentNode.rowIndex;
document.getElementById('dyntbl2').deleteRow(i);
}
function fixscreen() {
var buffer = document.all.item(0).outerHTML;
document.open("text/html", "replace");
document.write(buffer);
document.close();
}
function addCol() {
var vCell,tmp;
for (var i=0; i<dyntbl1.rows.length; i++) {
tmp=dyntbl1.rows[i].cells[dyntbl1.rows[i].cells.length-1].cloneNode(true);
dyntbl1.rows[i].deleteCell();
vCell=dyntbl1.rows[i].insertCell();
vCell.innerHTML=i==0?"<input type=button value=' X ' onclick='delCol(parentNode.cellIndex)'>":" ";
vCell=dyntbl1.rows[i].insertCell();
vCell.innerHTML=tmp.innerHTML;
}
}
function delCol(idx) {
for (var i=0; i<=dyntbl1.rows.length; i++) {
dyntbl1.rows[i].cells[idx].removeNode();
}
}
</script>
<script language="javascript">
// 글자수 제한
var char_min = parseInt(<?=$write_min?>); // 최소
var char_max = parseInt(<?=$write_max?>); // 최대
</script>
<script language="JavaScript">
// 이메일 자동입력
<!--
function checkemailaddy(){
if (fwrite.email_select.value == '1') {
fwrite.email2.readOnly = false;
fwrite.email2.value = '';
fwrite.email2.focus();
}
else {
fwrite.email2.readOnly = true;
fwrite.email2.value = fwrite.email_select.value;
}
}
//-->
</script>
<script>
//전화번호 자동 하이픈적용
<!--
function OnCheckPhone(oTa) {
var oForm = oTa.form ;
var sMsg = oTa.value ;
var onlynum = "" ;
onlynum = RemoveDash2(sMsg);
if(event.keyCode != 8 ) {
if (GetMsgLen(onlynum) <= 2) oTa.value = onlynum ;
if (GetMsgLen(onlynum) == 3) oTa.value = onlynum + "-";
if (GetMsgLen(onlynum) == 4) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,4) ;
if (GetMsgLen(onlynum) == 5) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,5) ;
if (GetMsgLen(onlynum) == 6) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,6) ;
if (GetMsgLen(onlynum) == 7) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,7) ;
if (GetMsgLen(onlynum) == 8) oTa.value = onlynum.substring(0,4) + "-" + onlynum.substring(4,8) ;
if (GetMsgLen(onlynum) == 9) oTa.value = onlynum.substring(0,4) + "-" + onlynum.substring(4,9) ;
}
}
function RemoveDash2(sNo) {
var reNo = ""
write.skin.php 파일에 올려주신 소스 붙여넣기 해봤지만 여전히 아무런 변화가 없습니다 ㅠ.ㅠ
옵션값에서 0을 빼야되나요? 제가 초보라 잘 이해가 안됩니다 ㅠ.ㅠ
아래와 같이 태그를 넣었는데 잘 되지 않습니다 ㅠ.ㅠ
그누보드 4라서 그런건지 ㅠ.ㅠ 왜 저는 잘 안될까요..
<script type="text/javascript">
var dt = new Date();
var zeroFill = "0";
var m = (zeroFill + (dt.getMonth() + 1)).slice(-2) + "월";
var d = (zeroFill + dt.getDate()).slice(-2) + "일";
$(function() {
if(!$("input[name='w']").val()) {
$("select[name='wr_7']").val(m);
$("select[name='wr_8']").val(d);
}
});
</script>
<select class="ed" name="wr_7" itemname='<?=$board[bo_7_subj]?>' required value="<?=$write[wr_7]?>">
<?
if ($write[wr_7]){
echo "<option selected value='$write[wr_7]'>$write[wr_7]</option>";
} else {
echo "<option selected value=''>월</option>";
}
echo "$bo_7_option";
?>
</select>
<select class="ed" name="wr_8" itemname='<?=$board[bo_8_subj]?>' required value="<?=$write[wr_8]?>">
<?
if ($write[wr_8]){
echo "<option selected value='$write[wr_8]'>$write[wr_8]</option>";
} else {
echo "<option selected value=''>일</option>";
}
echo "$bo_8_option";
?>
</select>
<select class="ed" name="wr_10" itemname='<?=$board[bo_9_subj]?>' required value="<?=$write[wr_10]?>">
<?
if ($write[wr_10]){
echo "<option selected value='$write[wr_10]'>$write[wr_10]</option>";
} else {
echo "<option selected value=''>시간</option>";
}
echo "$bo_9_option";
?>
</select></td>
</tr>
정말 감사합니다!!
잘 처리되었습니다. !!!!!♡,♡