首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

js判断是不是功能可用

2012-11-20 
js判断是否功能可用//判断是否有此功能%!public boolean check(String function, String[] functions) {?

js判断是否功能可用

//判断是否有此功能
<%!public boolean check(String function, String[] functions) {
??if (functions == null || functions.length == 0) {
???return true;
??}
??for (int i = 0; i < functions.length; i++) {
???if (function.equals(functions[i])) {
????return true;
???}
??}
??return false;
?}%>
<%
request.setCharacterEncoding("utf-8");
%>

//定义可用的功能
<%
?String[] functions = new String[] { "overview", "navigator", "layerControl", "spatialQuery", "sqlQuery", "bufferQuery", "findPath", "findNearest",
?"edit", "closestFacility", "overlayAnalyst", "dynamicTheme", "statistic", "switchMap"};
%>

//判断是否可用
<%
?? if (check("overview", functions)) {
%>
????? zhongguo
<%}%>

热点排行