게시판 글쓰기 할때 2차 셀렉트 연동문제.. 정보
게시판 글쓰기 할때 2차 셀렉트 연동문제..본문
댓글 전체
write.skin.php 이파일에서 수정할 소스 좀 ㅠㅠ;;
<script language="JavaScript"><!--
a1 = new Array( "디젤식",
"LPG식",
"전동식",
"견인/운반차",
"스키드로다",
"어테치");
suba = new Array();
suba["메인카타고리 선택"] = new Array("메인카타고리를 선택하세요.");
suba["디젤식"] = new Array( "HDF15/18-5",
"FOLEX 20D/25D/30D/33D",
"FOLEX 35D/40D/45D",
"HDF50/70-7",
"FOLEX 100D/120D/135D/160D");
suba["LPG식"] = new Array( "FOLEX 20L/25L/30L",
"FOLEX 15L/18L/20LA");
suba["전동식"] = new Array( "FOLEX 16/18/20B AC",
"FOLEX 22/25/30/32BAC",
"FOLEX 35/40/45/50BAC",
"FOLEX 15/18/20BT AC",
"HBR14/15/18/20/25-7");
suba["견인/운반차"] = new Array( "FOLEX 40T/15P");
suba["스키드로다"] = new Array( "HSL 550-7",
"HSL 650-7",
"HSL 850-7");
suba["어테치"] = new Array( "-어테치-");
function view_cat1(inForm) {
inForm.cat1.options.length = a1.length + 1;
inForm.cat1.options[0] = new Option("1차선택", "notset", true, false);
for (var i = 1; i <= a1.length; i++) {
inForm.cat1.options[i] = new Option(a1[i-1]);
}
}
function view_cat2(inForm) {
var s = inForm.cat1.options[inForm.cat1.selectedIndex].text;
inForm.cat2.options.length = suba[s].length + 1;
inForm.cat2.options[0] = new Option("2차항목", "notset", true, false);
for (var i = 1; i <= suba[s].length; i++) {
inForm.cat2.options[i] = new Option(suba[s][i-1]);
}
}
//-->
</script>
<onLoad=view_cat1(window.document.Form)>
<FORM name=Form>
<select name=cat1 onChange=view_cat2(this.form)>
<option>1차선택</option>
</select>
<select name=cat2>
<option>2차항목</option>
</select>
</FORM>
이렇게 입력했는데 흠.. 안되네요..
a1 = new Array( "디젤식",
"LPG식",
"전동식",
"견인/운반차",
"스키드로다",
"어테치");
suba = new Array();
suba["메인카타고리 선택"] = new Array("메인카타고리를 선택하세요.");
suba["디젤식"] = new Array( "HDF15/18-5",
"FOLEX 20D/25D/30D/33D",
"FOLEX 35D/40D/45D",
"HDF50/70-7",
"FOLEX 100D/120D/135D/160D");
suba["LPG식"] = new Array( "FOLEX 20L/25L/30L",
"FOLEX 15L/18L/20LA");
suba["전동식"] = new Array( "FOLEX 16/18/20B AC",
"FOLEX 22/25/30/32BAC",
"FOLEX 35/40/45/50BAC",
"FOLEX 15/18/20BT AC",
"HBR14/15/18/20/25-7");
suba["견인/운반차"] = new Array( "FOLEX 40T/15P");
suba["스키드로다"] = new Array( "HSL 550-7",
"HSL 650-7",
"HSL 850-7");
suba["어테치"] = new Array( "-어테치-");
function view_cat1(inForm) {
inForm.cat1.options.length = a1.length + 1;
inForm.cat1.options[0] = new Option("1차선택", "notset", true, false);
for (var i = 1; i <= a1.length; i++) {
inForm.cat1.options[i] = new Option(a1[i-1]);
}
}
function view_cat2(inForm) {
var s = inForm.cat1.options[inForm.cat1.selectedIndex].text;
inForm.cat2.options.length = suba[s].length + 1;
inForm.cat2.options[0] = new Option("2차항목", "notset", true, false);
for (var i = 1; i <= suba[s].length; i++) {
inForm.cat2.options[i] = new Option(suba[s][i-1]);
}
}
//-->
</script>
<onLoad=view_cat1(window.document.Form)>
<FORM name=Form>
<select name=cat1 onChange=view_cat2(this.form)>
<option>1차선택</option>
</select>
<select name=cat2>
<option>2차항목</option>
</select>
</FORM>
이렇게 입력했는데 흠.. 안되네요..
<Script Language='javaScript'>
<!--
//==========================================================//
// Element 및 값 정의
//==========================================================//
FirstSelectName = "sel1";// 처음 Select Element의 이름
SecondSelectName = "sel2";// 두번째 Select Element의 이름
FirstSelectText = new Array("디젤식","LPG식","전동식","견인/운반차","스키드로다","어테치");
FirstSelectValue = new Array("a","b","c","d","e","f");
SecondSelectText = new Array();
SecondSelectValue = new Array();
SecondSelectText[0] = new Array("HDF15/18-5","FOLEX 20D/25D/30D/33D","FOLEX 35D/40D/45D","HDF50/70-7","FOLEX 100D/120D/135D/160D");
SecondSelectText[1] = new Array("FOLEX 20L/25L/30L","FOLEX 15L/18L/20LA");
SecondSelectText[2] = new Array("FOLEX 16/18/20B AC","FOLEX 22/25/30/32BAC","FOLEX 35/40/45/50BAC","FOLEX 15/18/20BT AC","HBR14/15/18/20/25-7");
SecondSelectText[3] = new Array("FOLEX 40T/15P");
SecondSelectText[4] = new Array("HSL 550-7","HSL 650-7","HSL 850-7");
SecondSelectText[5] = new Array("-어테치-");
SecondSelectValue[0] = new Array("HDF15/18-5","FOLEX 20D/25D/30D/33D","FOLEX 35D/40D/45D","HDF50/70-7","FOLEX 100D/120D/135D/160D");
SecondSelectValue[1] = new Array("FOLEX 20L/25L/30L","FOLEX 15L/18L/20LA");
SecondSelectValue[2] = new Array("FOLEX 16/18/20B AC","FOLEX 22/25/30/32BAC","FOLEX 35/40/45/50BAC","FOLEX 15/18/20BT AC","HBR14/15/18/20/25-7");
SecondSelectValue[3] = new Array("FOLEX 40T/15P");
SecondSelectValue[4] = new Array("HSL 550-7","HSL 650-7","HSL 850-7");
SecondSelectValue[5] = new Array("-어테치-");
//==========================================================//
//-->
</script>
<Script Language='JavaScript'>
<!--
// 현재의 Element들이 속해있는 form의 위치를 자동으로 찾차주는 함수
thisFormCheckString = "This_is_Dynamic_Select_Form";
document.write("<input type='hidden' name='"+thisFormCheckString+"'>");
function FindThisFormName()
{
var d = document;
var n = d.forms.length;
if(n == 0)return 0;
for(var i=0;i<n;i++)
{
var e = d.forms[i].elements;
for(var x=0;x<e.length;x++)
{
if(e[x].name == thisFormCheckString)
return i;
}
}
return "_Nothing_";
}
thisFormName = FindThisFormName();// 현재폼
if(thisFormName == "_Nothing_")
{
var FormIsCreated = "Dynamic_Select_Form";
thisFormName = FormIsCreated;
document.write("<form name='"+FormIsCreated+"'>");
}
function CreateSecondSelect()
{
var f = document.forms[thisFormName];
var n = f[FirstSelectName].selectedIndex;
var l = SecondSelectText[n].length;
f[SecondSelectName].options.length = l;
for(var i=0;i<l;i++)
{
f[SecondSelectName].options[i].text = SecondSelectText[n][i];
f[SecondSelectName].options[i].value = SecondSelectValue[n][i];
}
f[SecondSelectName].selectedIndex=0;
}
//-->
</script>
<Script Language='JavaScript'>
<!--
document.write("<select name='"+FirstSelectName+"' onChange='CreateSecondSelect()'>");
for(var i=0;i < FirstSelectText.length;i++)
document.write("<option value='"+FirstSelectValue[i]+"'>"+FirstSelectText[i]+"</option>");
document.write("</select>");
//-->
</script>
<Script Language='JavaScript'>
<!--
document.write("<select name='"+SecondSelectName+"'>");
document.write("<option value=''></option>");
document.write("</select>");
if(FormIsCreated) document.write("</form>");
CreateSecondSelect();
//-->
</script>
검색해서 찾은 소스로 이렇게 해서 제대로 표시는 되는데 글 작성을 해도 게시판 확인하면 내용이 안올라가네요..
추가해야 할게 어떤 부분인지;;;;
<!--
//==========================================================//
// Element 및 값 정의
//==========================================================//
FirstSelectName = "sel1";// 처음 Select Element의 이름
SecondSelectName = "sel2";// 두번째 Select Element의 이름
FirstSelectText = new Array("디젤식","LPG식","전동식","견인/운반차","스키드로다","어테치");
FirstSelectValue = new Array("a","b","c","d","e","f");
SecondSelectText = new Array();
SecondSelectValue = new Array();
SecondSelectText[0] = new Array("HDF15/18-5","FOLEX 20D/25D/30D/33D","FOLEX 35D/40D/45D","HDF50/70-7","FOLEX 100D/120D/135D/160D");
SecondSelectText[1] = new Array("FOLEX 20L/25L/30L","FOLEX 15L/18L/20LA");
SecondSelectText[2] = new Array("FOLEX 16/18/20B AC","FOLEX 22/25/30/32BAC","FOLEX 35/40/45/50BAC","FOLEX 15/18/20BT AC","HBR14/15/18/20/25-7");
SecondSelectText[3] = new Array("FOLEX 40T/15P");
SecondSelectText[4] = new Array("HSL 550-7","HSL 650-7","HSL 850-7");
SecondSelectText[5] = new Array("-어테치-");
SecondSelectValue[0] = new Array("HDF15/18-5","FOLEX 20D/25D/30D/33D","FOLEX 35D/40D/45D","HDF50/70-7","FOLEX 100D/120D/135D/160D");
SecondSelectValue[1] = new Array("FOLEX 20L/25L/30L","FOLEX 15L/18L/20LA");
SecondSelectValue[2] = new Array("FOLEX 16/18/20B AC","FOLEX 22/25/30/32BAC","FOLEX 35/40/45/50BAC","FOLEX 15/18/20BT AC","HBR14/15/18/20/25-7");
SecondSelectValue[3] = new Array("FOLEX 40T/15P");
SecondSelectValue[4] = new Array("HSL 550-7","HSL 650-7","HSL 850-7");
SecondSelectValue[5] = new Array("-어테치-");
//==========================================================//
//-->
</script>
<Script Language='JavaScript'>
<!--
// 현재의 Element들이 속해있는 form의 위치를 자동으로 찾차주는 함수
thisFormCheckString = "This_is_Dynamic_Select_Form";
document.write("<input type='hidden' name='"+thisFormCheckString+"'>");
function FindThisFormName()
{
var d = document;
var n = d.forms.length;
if(n == 0)return 0;
for(var i=0;i<n;i++)
{
var e = d.forms[i].elements;
for(var x=0;x<e.length;x++)
{
if(e[x].name == thisFormCheckString)
return i;
}
}
return "_Nothing_";
}
thisFormName = FindThisFormName();// 현재폼
if(thisFormName == "_Nothing_")
{
var FormIsCreated = "Dynamic_Select_Form";
thisFormName = FormIsCreated;
document.write("<form name='"+FormIsCreated+"'>");
}
function CreateSecondSelect()
{
var f = document.forms[thisFormName];
var n = f[FirstSelectName].selectedIndex;
var l = SecondSelectText[n].length;
f[SecondSelectName].options.length = l;
for(var i=0;i<l;i++)
{
f[SecondSelectName].options[i].text = SecondSelectText[n][i];
f[SecondSelectName].options[i].value = SecondSelectValue[n][i];
}
f[SecondSelectName].selectedIndex=0;
}
//-->
</script>
<Script Language='JavaScript'>
<!--
document.write("<select name='"+FirstSelectName+"' onChange='CreateSecondSelect()'>");
for(var i=0;i < FirstSelectText.length;i++)
document.write("<option value='"+FirstSelectValue[i]+"'>"+FirstSelectText[i]+"</option>");
document.write("</select>");
//-->
</script>
<Script Language='JavaScript'>
<!--
document.write("<select name='"+SecondSelectName+"'>");
document.write("<option value=''></option>");
document.write("</select>");
if(FormIsCreated) document.write("</form>");
CreateSecondSelect();
//-->
</script>
검색해서 찾은 소스로 이렇게 해서 제대로 표시는 되는데 글 작성을 해도 게시판 확인하면 내용이 안올라가네요..
추가해야 할게 어떤 부분인지;;;;