/******************************************************************************* * Forms.js * -------------------- * update : 2004년 7월 20일 화요일 * version : 0.5.2 * authors : 안세원 * email : aminoai@aminoai.com * description : 기본제공 Forms 대신 사용자 Forms를 사용한다. ******************************************************************************/ // 생성자 function Forms(i, d, c) { // 속성 this.id = i; // 객체 이름 this.name = ""; // form 이름 this.dir = ""; // 이미지 경로 this.color = c; // 롤오버 색상 this.radiobutton_count = new Array(); this.select_count = new Array(); this.select_option = new Array(); this.opt_width = new Array(); this.opt_height = new Array(); // 함수 this.formOpen = formOpen; this.formClose = formClose; this.Textfield = Textfield; this.Password = Password; this.Textarea = Textarea; this.Button = Button; this.Image = Image; this.Checkbox = Checkbox; this.Radiobutton = Radiobutton; this.Select = Select; this.SelectOption = SelectOption; this.compOver = compOver; this.compOut = compOut; this.compDown = compDown; this.compUp = compUp; this.clickCheckbox = clickCheckbox; this.clickRadiobutton = clickRadiobutton; this.clickSelect = clickSelect; this.clickSelectOption = clickSelectOption; this.showSelect = showSelect; this.hideSelect = hideSelect; this.stringWidth = stringWidth; } /** * form을 열고 시작한다. 반드시 formEnd 함수로 닫아주어야 한다. * * @param string 전송위치 * * @param string 전송방법 * * @return string form 시작 태그 * * @access public */ function formOpen(n, a, m) { this.name = n; var action = a; var method = m; /* option은 사용 안함 var option = ""; if ( o != undefined ) { for ( var i = 0; i < o.length; i++ ){ if ( o[i][0] != "name" || o[i][0] != "action" || o[i][0] != "method" || o[i][0] != "style" ) { option += " " + o[i][0] + " = \"" + o[i][1] + "\""; } } } */ document.writeln("
"); } /** * formStart 함수로 연 form을 닫는다. * * @return string form 끝 태그 * * @access public */ function formClose() { document.writeln("
"); } /** * Textfield 를 만든다. * * @param string 태그 이름 * * @param int 필드 사이즈 * * @param string (optional) 값 * * @return string Textfield * * @access public */ function Textfield(n, s, v) { var name = n; var size = s; var id = this.id; var color = this.color; var dir = this.dir; var value = ""; if ( v != undefined ) { value = v; } var res = ""; res = ""; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += "
"; document.writeln(res); } function Password(n, s, v) { var name = n; var size = s; var id = this.id; var color = this.color; var dir = this.dir; var value = ""; if ( v != undefined ) { value = v; } var res = ""; res = ""; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += "
"; document.writeln(res); } /** * Textarea 를 만든다. * * @param string 태그 이름 * * @param int cols 사이즈 * * @param int rows 사이즈 * * @param string 마우스 오버 색상 * * @param string (optional) 값 * * @return string Textarea * * @access public */ function Textarea(n, c, r, v, o) { var name = n; var cols = c; var rows = r; var form = this.name; var id = this.id; var color = this.color; var dir = this.dir; var value = ""; if ( v != undefined ) { value = v; } var option = ""; if ( o != undefined ) { option = o; } var res = ""; res = ""; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += "
"; document.writeln(res); } /** * Checkbox를 만든다. * * @param string 이름 * * @param string 값 * * @param boolean 체크선택 * * @return string Checkbox * * @access public */ function Checkbox(n, v, c) { var name = n; var id = this.id; var dir = this.dir; var src_default = dir+"checkbox.gif"; var value = ""; if ( v != undefined ) { value = v; } var res = ""; res = ""; res += ""; document.writeln(res); if ( c === true ) { this.clickCheckbox(name, value); } } /** * Radiobutton를 만든다. * * @param string 태그 이름 * * @param string 값 * * @param boolean 체크선택 * * @return string Checkbox * * @access public */ function Radiobutton(n, v, c) { var name = n; var value = v; var id = this.id; var dir = this.dir; var src_default = dir+"radiobutton.gif"; if ( this.radiobutton_count[name] === undefined ) { this.radiobutton_count[name] = 1; } else { this.radiobutton_count[name]++; } var count = this.radiobutton_count[name]; //이미 등록된 라디오버튼은 폼을 추가등록 할 필요 없음 if( count == 1 ) { document.writeln(""); } var res = ""; res = ""; document.writeln(res); if ( c === true ) { this.clickRadiobutton(name, value, count); } } /** * Button 를 만든다. * * @param string 태그 이름 * * @param string 버튼 소스 경로 * * @param array (optional) 이외의 옵션 * * @return string Button * * @access public */ function Button(n, l, w, h, a) { var name = n; var label = ""; var width = ""; var height = ""; var align = ""; var id = this.id; var dir = this.dir; if ( l === undefined ) { label = "Button"; } else { label = l; } if ( w === undefined ) { width = 100; } else { width = w; } if ( h === undefined ) { height = 22; } else { height = h; } if ( a === undefined ) { align = "center"; } else { align = a; } var res = ""; res = ""; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += "
"; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += "
"+label+"
"; res += "
"; document.writeln(res); } /** * Image 를 만든다. * * @param string 태그 이름 * * @param string 버튼 소스 경로 * * @param array (optional) 이외의 옵션 * * @return string Button * * @access public */ function Image(n, s) { var name = n; var src = s; document.writeln(""); } function Select(n) { var name = n; var id = this.id; var dir = this.dir; var res = ""; res = ""; res += ""; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += "
"; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += " "; res += "
"; res += " "; res += " "; res += " "; res += " "; res += " "; res += "
"; res += "
"; res += "
"; res += "

"; if ( this.select_option[name] === undefined ) { this.select_option[name] = html; } else { this.select_option[name] = this.select_option[name] + html; } var scroll_head = "
"; //scroll_head += "
"; scroll_head += "
"; var scroll_foot = "
"; var option_head = ""; option_head = ""; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_head += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += " "; option_foot += "
"; var option_foot = ""; option_foot += "
"; var controler_head = ""; controler_head += ""; controler_head += ""; controler_head += " "; controler_head += ""; controler_head += ""; controler_head += " "; controler_foot += ""; controler_foot += ""; controler_foot += " "; controler_foot += ""; controler_foot += "
"; var controler_foot = ""; controler_foot += "
"; // 첫번째 옵션이거나 체크가 있으면 값 설정 if (this.select_count[name]==1 || c == true){ this.clickSelectOption(name, label, value); } if ( is_scroll ){ document.getElementById(opt_name).innerHTML = option_head+controler_head+scroll_head+this.select_option[name]+scroll_foot+controler_foot+option_foot; } else { document.getElementById(opt_name).innerHTML = option_head+scroll_head+this.select_option[name]+scroll_foot+option_foot; } } function hideSelect(n) { var opt_name = n+"_option"; document.getElementById(opt_name).style.display = "none"; } function showSelect(n) { var opt_name = n+"_option"; document.getElementById(opt_name).style.display = "inline"; } function clickSelectOption(n, l, v) { var name = n; var label = l; var value = v; var form_name = this.name; document.getElementById(name+"_label").innerHTML = label; eval("document."+form_name+"."+name+".value = '"+value+"';"); this.hideSelect(name); } function clickSelect(n) { var opt_name = n+"_option"; var sel_name = n+"_select"; var tar_opt = document.getElementById(opt_name); var tar_sel = document.getElementById(sel_name); var sel_height = parseInt(document.getElementById(n+"_scroll_parent").style.height); var win_height = document.body.clientHeight; var mouse_height = thisMousePosition[1]; var sel_y = document.getElementById(sel_name).offsetTop; var max_height = screen.height/4; if (this.opt_height[n] < max_height) { sel_height = sel_height - 14; } // up if ( sel_height + mouse_height > win_height && mouse_height > 110 ) { tar_opt.style.top = sel_y - sel_height - 18; tar_opt.style.paddingTop = 0; tar_opt.style.paddingBottom = 23; tar_opt.valign = "top"; } // down else { tar_opt.style.top = sel_y; tar_opt.style.paddingTop = 23; tar_opt.style.paddingBottom = 0; tar_opt.valign = "bottom"; } if ( tar_opt.style.display == "none" ) { tar_opt.style.display = "inline"; } else { tar_opt.style.display = "none"; } } /** * Checkbox를 클릭했을때 행동 * * @param string 이름 * * @param string 값 * * @return string Checkbox * * @access private */ function clickCheckbox(n, v) { var form_name = this.name; var dir = this.dir; var name = n; var value = v; var src_default = dir+"checkbox.gif"; var src_checked = dir+"checkbox_checked.gif"; if ( eval("document."+form_name+"."+name+".value") == "" ) { eval("document."+form_name+"."+name+".value = '"+value+"';"); eval("document."+name+"_checkbox.src = '"+src_checked+"';"); } else { eval("document."+form_name+"."+name+".value = '';"); eval("document."+name+"_checkbox.src = '"+src_default+"';"); } } /** * Radiobutton을 클릭했을때 행동 * * @param string 이름 * * @param string 값 * * @param integer 라디오버튼 번호 * * @return string Checkbox * * @access private */ function clickRadiobutton(n, v, c) { var name = n; var value = v; var form_name = this.name; var count = c; var count_num = this.radiobutton_count[name]; var dir = this.dir; var src_default = dir+"radiobutton.gif"; var src_checked = dir+"radiobutton_checked.gif"; // 라디오 버튼 초기화 for ( var i=1; i < count_num+1; i++ ) { eval("document."+name+"_radiobutton_"+i+".src = '"+src_default+"';"); } eval("document."+form_name+"."+name+".value = '"+value+"';"); eval("document."+name+"_radiobutton_"+count+".src = '"+src_checked+"';"); } function compOver(n) { var name = n; var color = this.color; for (i=0; i<4; i++) { eval("document.getElementById('"+name+"_hover"+i+"').style.backgroundColor = \""+color+"\";"); } } function compOut(n) { for (i=0; i<4; i++) { eval("document.getElementById('"+n+"_hover"+i+"').style.backgroundColor = \"\";"); } } function compDown(n) { for (i=0; i<3; i++) { eval("document.getElementById('"+n+"_down"+i+"').style.backgroundColor = \"#DEDEDE\";"); } eval("document.getElementById('"+n+"_label').style.paddingTop = 2;"); eval("document.getElementById('"+n+"_label').style.paddingLeft = 2;"); eval("document.getElementById('"+n+"_label').style.paddingRight = 0;"); eval("document.getElementById('"+n+"_label').style.paddingBottom = 0;"); } function compUp(n) { for (i=0; i<3; i++) { eval("document.getElementById('"+n+"_down"+i+"').style.backgroundColor = \"\";"); } eval("document.getElementById('"+n+"_label').style.paddingTop = 1;"); eval("document.getElementById('"+n+"_label').style.paddingLeft = 1;"); eval("document.getElementById('"+n+"_label').style.paddingRight = 1;"); eval("document.getElementById('"+n+"_label').style.paddingBottom = 1;"); } function stringWidth(v) { var value = v; var count = 0; var gap = 0; for (kk=0; kk= 0){mac = true;} function getMouseInformation(e) { /* thisMousePosition = new Array(); if(nn4 || nn6) { thisMousePosition[0] = myEvent.pageX; thisMousePosition[1] = myEvent.pageY; } else { thisMousePosition[0] = window.event.clientX; thisMousePosition[1] = window.event.clientY; } */ thisMousePosition = new Array(); if (document.layers){ thisMousePosition[0] = e.x; thisMousePosition[1] = e.y; } else if (document.all){ thisMousePosition[0] = event.clientX; thisMousePosition[1] = event.clientY; } else if (document.getElementById){ thisMousePosition[0] = e.clientX; thisMousePosition[1] = e.clientY; } return(thisMousePosition); } document.onmousemove = getMouseInformation; if(document.captureEvents) {document.captureEvents(Event.MOUSEMOVE);} function disableEventHandlers() { document.releaseEvents(Event.MOUSEMOVE); } function enableEventHandlers() { document.captureEvents(Event.MOUSEMOVE); document.onmousemove = getMouseInformation; } var isScrolling; var baseScrollSpeed = 1; if(!nn6) { var baseScrollStep = 1; } else { var baseScrollStep = 3; } function findElement(n,ly) { var curDoc = ly ? ly.document : document; var elem = curDoc[n]; if (!elem) { for (var i=0;i0) { if(nn4) { clipHeight = document.layers[parentLayerName].clip.height; } else { clipHeight = parentLayerData[3]; } if(childLayerData[0] > -(childLayerData[3] - clipHeight)) { setLayerPosition(childLayerName,0,(childLayerData[0]-scrollStep)); } } else { if(childLayerData[0] < 0) { setLayerPosition(childLayerName,0,(childLayerData[0]-scrollStep)); } } if(isScrolling) { setTimeout("doScroll(scrollStep)",baseScrollSpeed); } debug += "scrollStep : "+scrollStep+"\n"; debug += "parentLayerData : "+parentLayerData+"\n"; debug += "childLayerData : "+childLayerData+"\n"; debug += "childLayerData[0] : "+childLayerData[0]+"\n"; debug += "childLayerData[3] : "+childLayerData[3]+"\n"; debug += "able : "+(-(childLayerData[3] - clipHeight))+"\n"; debug += "clipHeight : "+clipHeight+"\n"; //document.form_fm.test_textarea.value = debug; } function getLayerInformation(thisLayer) { thisLayerPosition = new Array(); thisLayer = document.all ? document.all[thisLayer] : document.getElementById ? document.getElementById(thisLayer) : NSStyle(thisLayer); thisLayerPosition[0] = document.layers ? thisLayer.top : thisLayer.offsetTop; thisLayerPosition[1] = document.layers ? thisLayer.left : thisLayer.offsetLeft; thisLayerPosition[2] = document.layers ? thisLayer.document.width : thisLayer.offsetWidth; thisLayerPosition[3] = document.layers ? thisLayer.document.height : thisLayer.offsetHeight; return(thisLayerPosition); } function setLayerPosition(thisLayer,positionLeft,positionTop) { var unit = ""; thisLayer = document.all ? document.all[thisLayer] : document.getElementById ? document.getElementById(thisLayer) : NSStyle(thisLayer); thisLayer = document.layers ? thisLayer : thisLayer.style; if(document.getElementById) {unit = "px";} thisLayer.left = positionLeft + unit; thisLayer.top = positionTop + unit; return; }