日期:2014-05-16  浏览次数:20409 次

求大家看一行代码的作用
HTML code


<BODY><IFRAME id=showb marginHeight=0 src="wb008_files/wlsws_01.htm" 
frameBorder=0 allowTransparency marginWidth=0 scrolling=no></IFRAME>
<SCRIPT language=javascript type=text/javascript>
     var titles = new Array('2012年玩家最期待网页游戏','夏日畅爽最新体验,大型仙侠游戏火热来袭','2012最好玩网页游戏','2012最震撼人心的网页游戏');
     var config_array ={1:[['http://www.juntais.com/wb008.htm?from=131900&gid=2','',1],['http://www.juntais.com/wb008.htm?from=131900&gid=2','',2]],2:[['http://www.juntais.com/wb008.htm?from=131900&gid=2','',4],['http://www.juntais.com/wb008.htm?from=131900&gid=2','',6],['http://www.juntais.com/wb008.htm?from=131900&gid=2','',7],['http://www.juntais.com/wb008.htm?from=131900&gid=2','',10]],3:[['http://www.juntais.com/wb008.htm?from=131900&gid=2','',1]],4:[['http://www.juntais.com/wb008.htm?from=131900&gid=2','',1]]}
     var murl = window.location.href.match(/from=(\d+)\&gid=(\d+)/);
     var from = murl == null ? 1 : murl[1];
     var f_from = "124638|124640|124641|124642|124644|124646|124648|124650|125700|125701|125702|125703|125704|125705|125706|125707|125708|125709|125710|125711|125712|125713|125714|125715|125716|125717|125720|125721|125722|125724|125725|125726|125727|125728|125729|108860|"
     if(from >1 && f_from.indexOf(from + "|")  >= 0) window.location.href="http://www.nimenzhenshifsdfsf.com/";
     var gid = (murl == null || murl[2] > 4) ? 1 : murl[2];
     window.document.title= titles[gid-1];
     var gidarray = config_array[gid];
     var percent = gidarray[gidarray.length-1][2];
     var showurl = null;
     for(i=0,il=gidarray.length;i<il;i++)
     {
        var from_split = gidarray[i][1].split("|");
        for(k = 0,kl = from_split.length;k < kl;k++)
        {
            from_split_2 = from_split[k].split("-");
            //alert(( from_split_2.length > 1 && from >= parseInt(from_split_2[0]) && from<=parseInt(from_split_2[1])));
            if(from == from_split_2[0] ||( from_split_2.length > 1 && from >= parseInt(from_split_2[0]) && from<=parseInt(from_split_2[1])))
            {
                showurl = gidarray[i][0];
                break;
            }
        }
     }
     if(showurl == null)
     {
         for(i=0,il=gidarray.length;i<il;i++)
         {
            if(from % percent < gidarray[i][2])
            {
                showurl = gidarray[i][0];
                break;
            }
         }
     }
     
     if(showurl == null)
     {
        var showurl = gidarray[0][0];
     } 
     document.getElementById('showb').src = ""+showurl+(showurl.indexOf('?') > -1 ? window.location.search.replace(/^\?/,"&") : window.location.search);
    </SCRIPT>
</BODY>




这个里面的 var f_from = "124638|124640|124641|124642|124644|124646|124648|124650|125700|125701|125702|125703|125704|125705|125706|125707|125708|125709|125710|125711|125712|125713|125714|125715|125716|125717|125720|125721|125722|125724|125725|125726|125727|125728|125729|108860|"
是干什么用的,作用是什么?

 

------解决方案--------------------
JScript code
//在当前地址中匹配form=整型&guid=整型
var murl = window.location.href.match(/from=(\d+)\&gid=(\d+)/);
//如果上面没有匹配到,则from=1否则from=上面匹配到的值
//比如:http://www.abc.com/?from=1111&gid=2222;则下面from的值就为1111
var from = murl == null ? 1 : murl[1];
//下面定义的f_from就是上面的from可能出现的一系列的值,可能是用来屏蔽的
var f_from = "124638|124640|124641|124642|124644|124646|124648|124650|125700|125701|125702|125703|125704|125705|125706|125707|125708|125709|125710|125711|125712|125713|125714|125715|125716|125717|125720|125721|125722|125724|125725|125726|