Javascript函数挂起我的浏览器?

Javascript函数挂起我的浏览器?

问题描述:

您好我已经在我的页面中按照脚本动态突出显示地图。它会给出结果,但是在加载页面后,我的所有浏览器都被吸了,或者被无限下吊。



Hi I have followin script in my page to highlight the map dynamically.It's gives result but after loading the page, all my browser get sucked, or infinitely hanged.

<script>
       function highlight(list) {

           var jsVariable = list;
           var area = document.getElementsByTagName('area')
           var ary = []
           for (var zxc0 = 0; zxc0 < area.length; zxc0++) {
               ary.push(area);
           }
           var isfound = false;
           for (var i = 0; i < area.length; i++) {
               isfound = false;
               for (var j = 0; j < jsVariable.length; j++) {
                   var SpliData = jsVariable[i].trim().split(":");
                   if (area[i].getAttribute('title').trim() == SpliData[0].trim()) {
                       isfound = true;
                       $(area[i]).each(function ()//get all areas
                       {
                           $(this).addClass('Highlight_' + i)
                           var data = {};
                           $('.map').maphilight();
                           data.alwaysOn = true;
                           data.fillColor = SpliData[1];
                           $(this).data('maphilight', data).trigger('alwaysOn.maphilight');
                       });
                   }
                   if (!isfound) {
                       $(area[i]).each(function ()//get all areas
                       {
                           $(this).addClass("NoHighLight");
                       });
                   }
               }
           }
       }
   </script>



< / pre>

应该是什么原因?



FYU,浏览器在添加以下部分后开始挂起


</pre>
What should be the reason for that?

FYU, The browser starts to hang after adding the following part

$('.map').maphilight();
data.alwaysOn = true;
data.fillColor = SpliData[1];
$(this).data('maphilight', data).trigger('alwaysOn.maphilight');





由于此部分用于动态突出显示地图。



请帮帮我。



Since this part is used to highlight the map dynamically.

Please help me out.

(area [i])。each( function () // 获取所有区域
{
(area[i]).each(function ()//get all areas {


this )。addClass(' Highlight _' + i)
var data = {};
(this).addClass('Highlight_' + i) var data = {};


' .map')。maphilight();
data.alwaysOn = true ;
data.fillColor = SpliData [ 1 ];
('.map').maphilight(); data.alwaysOn = true; data.fillColor = SpliData[1];