If you are unable to create a new account, please email support@bspsoftware.com

 

Issue With Javascript when using it for hover over messages on a dashboard

Started by Sher123, 03 Mar 2016 04:03:26 AM

Previous topic - Next topic

Sher123

Hi,

I am trying create a hover over message so that when the user hovers over a word on my report a message appears in a hover over box. I have used JavaScript to do this and it work nearly exactly how I want it to however the problem I have is that sometimes when I load the report the JavaScript seems to stop working for no apparent reason even if I haven't edited or changed the report and secondly that when I place my report on a portlet page it says that the JavaScript is incompatible therefore it isn't able to load the report therefore would anyone be able to offer any help on this issue please. I will paste in the JavaScript below and I have taken my hover over text out of it and placed in some dummy text but the message doesn't really matter in this case its mainly the script used. Thanks for your help

The Script is as follows:


<html>
<head>
<title>
Popup message using javascript
</title>

<style type="text/css">
.boxpopup {
   font-family:Arial,sans-serif;
   text-align:left;   
   color:black; background:#FFFFFF;
   width:300px;         
   padding:5px 6px 5px 6px;     
   font-weight:bold;       
   border:1px dashed gray; 
   font-size:90%; 
   }
  #boxTail {position:absolute; visibility:hidden; z-index:200;}
 
</style>
</head>


<body>
<div id="boxTail"></div>
<script TYPE="text/javascript">
paddingPOPX=-135;
paddingPOPY=25; 
var skn,iex=(document.all),shiftPosition=-1000;
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all
if (ns4) myPOPCP=document.boxTail
else if (ns6) myPOPCP=document.getElementById("boxTail").style
else if (ie4) myPOPCP=document.all.boxTail.style
if (ns4) document.captureEvents(Event.MOUSEMOVE);
else {
myPOPCP.visibility="visible"
myPOPCP.display="none"
}
document.onmousemove=get_mouse;
function showPopup(content){
var content="<div class=boxpopup>"+content+"</div>";
shiftPosition=paddingPOPY;
if(ns4){myPOPCP.document.write(content);myPOPCP.document.close();myPOPCP.visibility="visible"}
if(ns6){document.getElementById("boxTail").innerHTML=content;myPOPCP.display=''}
if(ie4){document.all("boxTail").innerHTML=content;myPOPCP.display=''}
}
function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
myPOPCP.left=x+paddingPOPX;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
myPOPCP.top=y+shiftPosition;
}
function remove_popup(){
shiftPosition=-1000;
if(ns4){myPOPCP.visibility="hidden";}
else if (ns6||ie4)
myPOPCP.display="none"
}
//-->
</script>

<p align=center>
<a ref="/" alt="" onMouseOver="javascript:showPopup(' Test Message ');";
onMouseOut="remove_popup()">See here for explanation</a>
</p>
</body>


</html>