隸屬查詢:
名稱:
隸屬關係(0為向上,1為向下):
模糊查詢或精確查詢:(0:模糊查詢,1:精確查詢,不填預設1)
回傳筆數的上限:(預設1000)
設定回傳欄位:
(以半形逗號做分隔,ID,NAME,DYNASTY,RELATION_NAME, YEARSTART,YEAREND,WKT,WKTTYPE)
排序:(0:朝代)
範例程式碼(詳細請點右鍵觀看原始碼):
<script type="text/javascript" src="http://ccts.sinica.edu.tw/api/CCTS_API.js"> <script>
var relationObj = null;
function relationQry(){
var pName = document.getElementById("pName");
var relations = document.getElementById("relations");
var qNum = document.getElementById("qNum");
var rLimit = document.getElementById("rLimit");
var Fields = document.getElementById("Fields");
var order = document.getElementById("order");
var res = Fields.value.split(",");

var request = {
name: pName.value,
relation: parseInt(relations.value)
};
var option = {
queryNum: parseInt(qNum.value),
resultLimit: parseInt(rLimit.value),
order: order.value,
mapTypeIds: res
};

relationObj = new RelationQuery();
relationObj.identify(request, option, function(result, status){
if (result != "" && result != null) {
var aa = "";
var fName = result[0].fieldName.split(",");
aa += ""
for (var fn = 0; fn < fName.length; fn++) {
aa += "";
}
aa += "";
for (var i = 0; i < result[0]["fieldAttr"].length; i++) {
aa += "";
for (var fa = 0; fa < result[0]["fieldAttr"][i].length; fa++) {
aa += "";
}
aa += "";
}
aa += "
status" + fName[fn] + "
" + status + "" + result[0]["fieldAttr"][i][fa] + "
";
document.getElementById("view").innerHTML = aa;
}
else {
document.getElementById("view").innerHTML = status;
}
});
}
</script>