var artist=new Array();
var title=new Array();
var number;
function sample(){
var str;
var n=$("#te").val();
str=check(n);
$("#nc").text(str);
}
function check(w2){
var s;
var strx;
strx="moname";
for(s=0;s<number;s++){
if(artist[s].indexOf(w2)>-1)strx=title[s];
}
return strx;
}
function readfile(){
$.get("data.txt", function (data) {
var s;
var word = new Array();
var str;
word = data.split("</data>");
for (s = 0; s < word.length; s++) {
word[s] = word[s].replace("<data>", "");
}
for (s = 0; s < word.length; s++) {
artist[s] = catchword(word[s], "artist");
}
for (s = 0; s < word.length; s++) {
title[s] = catchword(word[s], "title");
}
number = word.length;
});
function catchword(str,wor){
var strx,str1,str2;
var p1, p2;
str1 = "<" + wor + ">";
str2 = "</" + wor + ">";
p1 = str.indexOf(str1);
p2 = str.indexOf(str2);
strx = str.substring(p1, p2);
strx = strx.replace(str1,"");
return strx;
}
}
最終更新:2013年09月22日 19:47