필드의 해당 label 값을 읽어서 보여주도록 수정
This commit is contained in:
24
js/wrest.js
24
js/wrest.js
@ -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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 양쪽 공백 없애기
|
// 양쪽 공백 없애기
|
||||||
|
|||||||
Reference in New Issue
Block a user