자바스크립트 소스 구합니다. 정보
기타 자바스크립트 소스 구합니다.본문
추천
0
0
댓글 2개
감사합니다.
해피스크립트에서 구했습니다.
다른분을 위해서 아래에 한가지 소개합니다.
--------------------------------------------------------------------------------------------
<HTML>
<HEAD>
<TITLE>home_us1.htm -- ITIL -- US Home Page 1</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function cleanup_option_list(form) {
form.city.options.length=0;
}
function change_city_option_list(form) {
cleanup_option_list(form);
var func_name="city_option_for_";
func_name += form.listdo.options[form.listdo.selectedIndex].value;
func_name += "(form)";
// alert(func_name);
eval(func_name);
}
function change_address_option_list(form) {
form.address.options.length=0;
var func_name="address_option_for_";
func_name += form.city.options[form.city.selectedIndex].value;
func_name += "(form)";
alert(func_name);
eval(func_name);
}
function city_option_for_aa(form) {
form.city.options[0] = new Option("aa_first city","aa_1");
form.city.options[1] = new Option("aa_second city","aa_2");
}
function city_option_for_bb(form) {
form.city.options[0] = new Option("** bb_first city **","bb_1");
form.city.options[1] = new Option("** bb_second city **","bb_2");
}
function address_option_for_aa_1(form) {
form.address.options[0] = new Option("aa_1 aaa_1 address","aaa_1");
form.address.options[1] = new Option("aa_1 aaa_2 address","aaa_2");
}
function address_option_for_aa_2(form) {
form.address.options[0] = new Option("aa_2 aaa_1 address","aaa_1");
form.address.options[1] = new Option("aa_2 aaa_2 address","aaa_2");
}
function address_option_for_bb_1(form) {
form.address.options[0] = new Option("bb_1 bbb_1 address","bbb_1");
form.address.options[1] = new Option("bb_1 bbb_2 address","bbb_2");
}
function address_option_for_bb_2(form) {
form.address.options[0] = new Option("bb_2 bbb_1 addr","bbb_1");
form.address.options[1] = new Option("bb_2 bbb_2 addr","bbb_2");
}
function option_selected(x){
if (x>=0){
return true;
} else {
return false;
}
}
function show(form){
if (!option_selected(form.city.selectedIndex)){
alert("City not selected");
return false;
} else {
var l_do =form.listdo.options[form.listdo.selectedIndex].value;
var l_city =form.city.options[form.city.selectedIndex].value;
alert ("Selected DO: "+ l_do +" Seleted City: "+ l_city);
return true;
}
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FORM NAME="form">
<FONT SIZE="2" COLOR="Red"><SPACER TYPE="Vertical" SIZE="10"><B>List do</B></FONT>
<FONT SIZE="3">
<SELECT NAME="listdo" SIZE="1" WIDTH="500" onChange="change_city_option_list(this.form);">
<OPTION VALUE="aa">aa-do</OPTION>
<OPTION VALUE="bb">bb-do</OPTION>
</SELECT></FONT>
<FONT SIZE="2" COLOR="Red"><SPACER TYPE="Vertical" SIZE="10">
<B>List ciry</B></FONT>
<FONT SIZE="3">
<SELECT NAME="city" SIZE="1" WIDTH="500" onChange="change_address_option_list(this.form);">
<OPTION>NO list-do SELECTED</OPTION>
</SELECT></FONT>
<FONT SIZE="2" COLOR="Red"><SPACER TYPE="Vertical" SIZE="10"><B>list address</B></FONT>
<FONT SIZE="3">
<SELECT NAME="address" SIZE="1" WIDTH="500">
<OPTION>NO address SELECTED</OPTION>
</SELECT></FONT>
<BR>
<BR>
<INPUT TYPE="Button" VALUE="Submit" OnClick="show(this.form);">
</FORM>
</BODY>
</HTML>
해피스크립트에서 구했습니다.
다른분을 위해서 아래에 한가지 소개합니다.
--------------------------------------------------------------------------------------------
<HTML>
<HEAD>
<TITLE>home_us1.htm -- ITIL -- US Home Page 1</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function cleanup_option_list(form) {
form.city.options.length=0;
}
function change_city_option_list(form) {
cleanup_option_list(form);
var func_name="city_option_for_";
func_name += form.listdo.options[form.listdo.selectedIndex].value;
func_name += "(form)";
// alert(func_name);
eval(func_name);
}
function change_address_option_list(form) {
form.address.options.length=0;
var func_name="address_option_for_";
func_name += form.city.options[form.city.selectedIndex].value;
func_name += "(form)";
alert(func_name);
eval(func_name);
}
function city_option_for_aa(form) {
form.city.options[0] = new Option("aa_first city","aa_1");
form.city.options[1] = new Option("aa_second city","aa_2");
}
function city_option_for_bb(form) {
form.city.options[0] = new Option("** bb_first city **","bb_1");
form.city.options[1] = new Option("** bb_second city **","bb_2");
}
function address_option_for_aa_1(form) {
form.address.options[0] = new Option("aa_1 aaa_1 address","aaa_1");
form.address.options[1] = new Option("aa_1 aaa_2 address","aaa_2");
}
function address_option_for_aa_2(form) {
form.address.options[0] = new Option("aa_2 aaa_1 address","aaa_1");
form.address.options[1] = new Option("aa_2 aaa_2 address","aaa_2");
}
function address_option_for_bb_1(form) {
form.address.options[0] = new Option("bb_1 bbb_1 address","bbb_1");
form.address.options[1] = new Option("bb_1 bbb_2 address","bbb_2");
}
function address_option_for_bb_2(form) {
form.address.options[0] = new Option("bb_2 bbb_1 addr","bbb_1");
form.address.options[1] = new Option("bb_2 bbb_2 addr","bbb_2");
}
function option_selected(x){
if (x>=0){
return true;
} else {
return false;
}
}
function show(form){
if (!option_selected(form.city.selectedIndex)){
alert("City not selected");
return false;
} else {
var l_do =form.listdo.options[form.listdo.selectedIndex].value;
var l_city =form.city.options[form.city.selectedIndex].value;
alert ("Selected DO: "+ l_do +" Seleted City: "+ l_city);
return true;
}
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FORM NAME="form">
<FONT SIZE="2" COLOR="Red"><SPACER TYPE="Vertical" SIZE="10"><B>List do</B></FONT>
<FONT SIZE="3">
<SELECT NAME="listdo" SIZE="1" WIDTH="500" onChange="change_city_option_list(this.form);">
<OPTION VALUE="aa">aa-do</OPTION>
<OPTION VALUE="bb">bb-do</OPTION>
</SELECT></FONT>
<FONT SIZE="2" COLOR="Red"><SPACER TYPE="Vertical" SIZE="10">
<B>List ciry</B></FONT>
<FONT SIZE="3">
<SELECT NAME="city" SIZE="1" WIDTH="500" onChange="change_address_option_list(this.form);">
<OPTION>NO list-do SELECTED</OPTION>
</SELECT></FONT>
<FONT SIZE="2" COLOR="Red"><SPACER TYPE="Vertical" SIZE="10"><B>list address</B></FONT>
<FONT SIZE="3">
<SELECT NAME="address" SIZE="1" WIDTH="500">
<OPTION>NO address SELECTED</OPTION>
</SELECT></FONT>
<BR>
<BR>
<INPUT TYPE="Button" VALUE="Submit" OnClick="show(this.form);">
</FORM>
</BODY>
</HTML>
해피스크립트에 가 보시면 있을거에요..