필드의 해당 label 값을 읽어서 보여주도록 수정

This commit is contained in:
chicpro
2013-01-21 18:56:04 +09:00
parent 05bc1fda26
commit 544e0a621a

View File

@ -6,7 +6,29 @@ var wrestFldBackColor = "#ff3061";
// subject 속성값을 얻어 return, 없으면 tag의 name을 넘김 // subject 속성값을 얻어 return, 없으면 tag의 name을 넘김
function wrestItemname(fld) function wrestItemname(fld)
{ {
return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("alt") ? fld.getAttribute("alt") : fld.name ); //return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("alt") ? fld.getAttribute("alt") : fld.name );
var id = fld.getAttribute("id");
var labels = document.getElementsByTagName("label");
var el = null;
for(i=0; i<labels.length; i++) {
if(id == labels[i].htmlFor) {
el = labels[i];
break;
}
}
if(el != null) {
var text = el.innerHTML.replace(/[<].*[>].*[<]\/+.*[>]/gi, "");
if(text == '') {
return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("alt") ? fld.getAttribute("alt") : fld.name );
} else {
return text;
}
} else {
return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("alt") ? fld.getAttribute("alt") : fld.name );
}
} }
// 양쪽 공백 없애기 // 양쪽 공백 없애기
@ -257,7 +279,7 @@ function wrestSubmit()
// 셀렉트 박스일때도 필수 선택 검사합니다. select-one // 셀렉트 박스일때도 필수 선택 검사합니다. select-one
if (el.type=="text" || el.type=="hidden" || el.type=="file" || el.type=="password" || el.type=="select-one" || el.type=="textarea") { if (el.type=="text" || el.type=="hidden" || el.type=="file" || el.type=="password" || el.type=="select-one" || el.type=="textarea") {
if (el.getAttribute("required") != null) { if (el.getAttribute("required") != null) {
wrestRequired(el); wrestRequired(el);
} }
var array_css = el.className.split(" "); // class 를 공백으로 나눔 var array_css = el.className.split(" "); // class 를 공백으로 나눔
@ -331,7 +353,7 @@ function wrestInitialized()
for (var j = 0; j < document.forms[i].elements.length; j++) { for (var j = 0; j < document.forms[i].elements.length; j++) {
// 필수 입력일 경우는 * 배경이미지를 준다. // 필수 입력일 경우는 * 배경이미지를 준다.
if (document.forms[i].elements[j].getAttribute("required") != null || if (document.forms[i].elements[j].getAttribute("required") != null ||
regexp.test(document.forms[i].elements[j].className)) { regexp.test(document.forms[i].elements[j].className)) {
//if (regexp.test(document.forms[i].elements[j].className)) { //if (regexp.test(document.forms[i].elements[j].className)) {
//document.forms[i].elements[j].style.backgroundColor = wrestFldDefaultColor; //document.forms[i].elements[j].style.backgroundColor = wrestFldDefaultColor;