我最近开始进行网络编程,我继承了以下问题,不幸的是现在这里是唯一的网络程序员,所以我没有人可以去寻求帮助。在下面的xslt代码中,有两个链接适用于IE但不适用于Firefox和Chrome:$(“#roatitle”)。click(function()和$(“#incometitle”)。click(function()。这些使用chartroaroe和chartnetincome。数据显示正确,标题正确(ROA / ROE,净收入);当悬停时光标变为指针,但点击什么也没做。我试图尽可能地减少代码论坛,希望没有删除重要的东西;那么,我如何让它在Firefox和Chrome中运行?
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<xsl:template match="/chartsdatareport">
<xsl:text disable-output-escaping="yes"><!DOCTYPE html></xsl:text>
<html>
<head>
<title>Company Tearsheet</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
var roeValues = [];
var roaValues = [];
<xsl:apply-templates select="privateroaroeratiosdata"/>
<xsl:apply-templates select="privateincomeratiosdata"/>
var chartroaroe;
var chartnetincome;
<xsl:text disable-output-escaping="yes">
<![CDATA[
function formatRating(val) {
if (val == 0 && ratingTA == 0 && entitytype=='Holding Company'){
return '<span style="font-size:20px">N/A</span>';
} else {
return '<span style="color:white">'+val+'</span>';
}
}
]]>
</xsl:text>
$(document).ready(function() {
chartrating = new Highcharts.Chart({
chart: {
renderTo: 'rating',
type: 'column',
backgroundColor: '#666666',
margin: 0,
spacingBottom: 5,
spacingLeft: 0,
spacingRight: 0
},
credits: {
enabled: false
},
exporting: {
buttons: {
exportButton: {
enabled: false
},
printButton: {
enabled: false
}
}
},
title: {
text: 'Banking Insight Rating',
style: {
display: 'none'
}
},
xAxis: {
categories: rating,
gridLineWidth: 0,
minorGridLineWidth: 0,
lineColor: 'transparent',
lineWidth: 0,
tickLength: 0,
minorTickLength: 0,
labels: {
enabled: true,
style: {
font: 'bold 26px Verdana',
color: '#FFFFFF'
},
y: -35,
formatter: function(){
return formatRating(this.value);
}
}
},
yAxis: {
gridLineWidth: 0,
lineWidth: 0,
min: 0,
max: 100,
labels: {
enabled: false
},
title: {
text: '',
margin: 0
}
},
plotOptions: {
column: {
stacking: 'normal',
borderWidth: 0,
point: {
events: {
mouseOut: function(){
$("#ratingtooltip").hide();
},
mouseOver: function(){
$("#ratingtooltip").show();
}
}
}
},
series: {
pointWidth: 50
}
},
tooltip: {
enabled: false
},
legend:{
enabled: false
},
series: [{
color: '#005A84',
data: revertrating
},{
color: '#FF9100',
data: rating
}]
});
chartroaroe = new Highcharts.Chart({
chart: {
renderTo: 'roaroe',
type: 'line'
},
credits: {
enabled: false
},
exporting: {
buttons: {
exportButton: {
enabled: false
},
printButton: {
enabled: false
}
}
},
title: {
text: '<span id="roatitle">ROA/ROE</span>',
style: {
fontFamily: 'Verdana',
fontWeight: 'bold',
color: '#666666',
cursor: 'pointer'
}
},
plotOptions: {
line: {
marker: {
symbol: 'circle'
}
},
series: {
dataLabels: {
enabled: true
}
}
},
tooltip: {
animation: false,
pointFormat: '<span style="color:#666666">{series.name}</span>: <b>{point.y}</b><br/>',
style: {
fontFamily: 'Verdana',
color: '#666666'
}
},
legend: {
itemStyle: {
fontSize: '12px',
fontFamily: 'Verdana',
color: '#666666'
}
},
xAxis: {
categories: roaroequarters.reverse(),
labels: {
style: {
fontFamily: 'Verdana'
}
}
},
yAxis: {
title: {
text: ''
}
},
series: [{
name: 'Return on Avg Equity (ROE) (Mixed)',
color: '#005A84',
data: roeValues.reverse()
},{
name: 'Return on Avg Assets (ROA) (Mixed)',
color: '#FF9100',
data: roaValues.reverse()
}]
});
chartnetincome = new Highcharts.Chart({
chart: {
renderTo: 'netincome',
type: 'line'
},
credits: {
enabled: false
},
exporting: {
buttons: {
exportButton: {
enabled: false
},
printButton: {
enabled: false
}
}
},
title: {
text: '<span id="incometitle">Net Income</span>',
style: {
fontFamily: 'Verdana',
fontWeight: 'bold',
color: '#666666',
cursor: 'pointer'
}
},
plotOptions: {
line: {
marker: {
symbol: 'circle'
}
},
series: {
dataLabels: {
enabled: true,
formatter: function(){
return addCommas(this.y);
}
}
}
},
tooltip: {
animation: false,
pointFormat: '<span style="color:#666666">{series.name}</span>: <b>{point.y}</b><br/>',
style: {
fontFamily: 'Verdana',
color: '#666666'
}
},
legend: {
itemStyle: {
fontSize: '12px',
fontFamily: 'Verdana',
color: '#666666'
}
},
xAxis: {
categories: incomequarters.reverse(),
labels: {
style: {
fontFamily: 'Verdana'
}
}
},
yAxis: {
title: {
text: ''
}
},
series: [{
name: 'Net Income',
color: '#005A84',
data: netIncomeValues.reverse()
},{
name: 'Net Interest Income',
color: '#FF9100',
data: netInterestIncomeValues.reverse()
}]
});
$("#roatitle").click(function()
{
<xsl:text>parent.getHighlineTop().newTab('/bats/company/PopupReport.do?entityID=</xsl:text>
<xsl:value-of select="//companyheader/id"/>
<xsl:text disable-output-escaping="yes"><![CDATA[&report=DYRPT%3A%3A118]]></xsl:text>
<xsl:text>','</xsl:text>
<xsl:value-of select="$link_value"/>
<xsl:text>',null,true,'companytabicon');</xsl:text>
});
$("#incometitle").click(function()
{
<xsl:text>parent.getHighlineTop().newTab('/bats/company/PopupReport.do?entityID=</xsl:text>
<xsl:value-of select="//companyheader/id"/>
<xsl:text disable-output-escaping="yes"><![CDATA[&report=EXCEL%3A%3A621]]></xsl:text>
<xsl:text>','</xsl:text>
<xsl:value-of select="$link_value"/>
<xsl:text>',null,true,'companytabicon');</xsl:text>
});
});
</script>
#netincome, #roaroe {
width: 49%;
height: 250px;
float:left;
}
</style>
</head>
<body>
<script src="/bats/highcharts/highcharts.js"></script>
<script src="/bats/highcharts/modules/exporting.js"></script>
<script src="/bats/js/uiUtilBats.js"></script>
<div id="netincome"></div>
<div id="roaroe"></div>
<table border="0" cellpadding="2" cellspacing="0" width="100%" class="fintable">
</table>
</body>
</html>
</xsl:template>
<xsl:variable name="apos">'</xsl:variable>
<xsl:variable name="escapos">\'</xsl:variable>
<xsl:variable name="link_value">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="//companyheader/title"/>
<xsl:with-param name="replace" select="$apos"/>
<xsl:with-param name="by" select="$escapos"/>
</xsl:call-template>
</xsl:variable>
<xsl:template match="privateroaroeratiosdata">
<xsl:for-each select="./datapoint">
roeValues.push(<xsl:value-of select="./roevalue"/>);
</xsl:for-each>
</xsl:template>
<xsl:template match="privateincomeratiosdata">
<xsl:for-each select="./datapoint">
netIncomeValues.push(<xsl:value-of select="./netincome"/>);
</xsl:for-each>
</xsl:template>
<xsl:template name="string-replace-all">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="by"/>
<xsl:choose>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$by"/>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text"
select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="by" select="$by"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>