티스토리 뷰

+ prototypeUtils.js

/*
prototypeUtils.js from http://jehiah.com/
Licensed under Creative Commons.
version 1.0 December 20 2005
version 2.0 2010-01-08 by darthJun

Contains:
+ unpackToForm()
*/
function unpackToForm(data){
 for (i in data){
  var val = (data[i]==null)? '' : data[i].valueOf();
  if($$("input[type=radio][name='"+i+"']").length > 1) { // when element is radio group
   $$("input[type=radio][name='"+i+"'][value='"+ val +"']")[0].writeAttribute("checked", "checked");
   continue;
  }
  if($(i)) $(i).setValue(val);
 }
}

+ 사용법



<% '// 입력할 데이터 JSON DATA 가공 by Classic ASP '// 아래 data 는 레코드 한줄을 해쉬에 받은것 For Each strKey In data strVal = data(strKey) If isset(strVal) Then strVal = str_replace("\", "\\", strVal) strVal = str_replace("'", "\'", strVal) strVal = str_replace(vbCrLf, "\n", strVal) strData = strData &"'"& strKey &"':'"& strVal &"'," End if Next strData = Left(strData, Len(strData)-1) %>

댓글