自己寫的用js讀取設定檔的程式
D:Useful StuffJavascriptmytest.txt
檔內容物🎜>
程式碼如下:
[plugin_page_search] wholeword=0 matchcase=1 hightlight=1 total=1 up=85
down=5
複製代碼
代碼如下:
f.Close();
function getINI(item,key)
{
new RegExp("\[" item "\](. )").exec(s);
var str=RegExp.$1;
var reg2=/(w )=(d )/;
var keyValue={};
str.replace(reg2,function(a,b,c){
keyValue[b]=c ;
});
return keyValue[key];
}
alert(getINI("data","up"));
alert(getINI("plugin_page_search","hightlight "));