获取Cognos10图表上的焦点

function addPillarClick()
   {
      // 获取所有立柱
      var areaObjs = document.getElementsByTagName('area');
      var titleTemp = undefined;
      var titleArray = undefined;
 
      for(var i = 0; i < areaObjs.length; i++) 
      {
    	 var type = areaObjs[i].getAttribute("type");
         if ("chartElement" == type || "ordinalAxisLabel" == type)
         {
             addClick(areaObjs[i]);   
         }
      }
   }
function innerClick(event){
	var e = event || window.event;
	var obj = e.srcElement || e.target;
	var temp_title = obj.getAttribute("title");
	if(temp_title.length>32 && temp_title.substring(temp_title.length-1)=="%"){
		return;
	}
          var subStr = temp_title.substring(temp_title.indexOf("%")-2,temp_title.indexOf("%"));
          var index = parseInt(subStr)/10+1;
          alert(subStr);
          alert(index);
       //和web页面负责交互
       /*  if(parent){
          if(parent.parent){
	  parent.parent.drillToPart(index);
         }
       }*/

}

    function addClick(areaObjs)
    {
	areaObjs.onfocus = function(){this.blur();};
    	var temp_title = areaObjs.getAttribute("title");
    	if(temp_title==null || temp_title == "" || temp_title.length>32 && temp_title.substring(temp_title.length-1)=="%"){
		return;
	}   		
           if(window.addEventListener){
        		//fireFox
		areaObjs.style.cursor = "pointer";
            	areaObjs.addEventListener('click',innerClick, true);  
        	}else if(window.attachEvent){  
        		//IE
                     areaObjs.style.cursor = "hand";

		areaObjs.href = "javascript:void(0);";
        		areaObjs.attachEvent('onclick', innerClick);  
        	}
    }
   
   addPillarClick();

 还可以通过下面的方法:将脚本部署到一个Tomcat服务器上,这块引用脚本即可

你可能感兴趣的:(Java)