Javascript 在C#.net中单击ASP按钮时如何停止JS执行?
我有一个问题,当我点击C#.net上的一个按钮时,它会重新加载JS并显示为空白 请提供帮助,因为当我单击按钮加载代码时,javascript被加载,div id=“chartContainer”被刷新,结果为空 它会继续重新加载,并且不会显示准确的结果。只是空的。它一开始加载OK,但一旦我单击按钮,它将刷新容器,使其为空Javascript 在C#.net中单击ASP按钮时如何停止JS执行?,javascript,c#,canvasjs,Javascript,C#,Canvasjs,我有一个问题,当我点击C#.net上的一个按钮时,它会重新加载JS并显示为空白 请提供帮助,因为当我单击按钮加载代码时,javascript被加载,div id=“chartContainer”被刷新,结果为空 它会继续重新加载,并且不会显示准确的结果。只是空的。它一开始加载OK,但一旦我单击按钮,它将刷新容器,使其为空 搜寻 我的Javascript: <% if (!IsPostBack) { %> <script type="text/javascri
搜寻
我的Javascript:
<% if (!IsPostBack)
{ %>
<script type="text/javascript">
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
theme: "theme3",
//interactivityEnabled: true,
animationEnabled: true,
animationDuration: 2000, //change to 1000, 500 etc
zoomEnabled: true,
title: {
text: "HPM Rolled Quantity (<%= String.Format("{0:MMMM}", DateTime.Now) %> <%= DateTime.Now.Year.ToString() %>)"
},
toolTip: {
enabled: true, //disable here
animationEnabled: true //disable here
},
exportFileName: "HPM RQ Report", //Give any name accordingly
exportEnabled: true,
axisX: {
valueFormatString: "####",
interval: 1
},
axisY: [{
title: "RQ (Ton)",
lineColor: "#369EAD",
titleFontColor: "#369EAD",
labelFontColor: "#369EAD",
},
],
axisY2: [{
title: "RQ (Pcs)",
lineColor: "#7F6084",
titleFontColor: "#7F6084",
labelFontColor: "#7F6084"
},
],
data: [
{
//indexLabel: "{y}",
//indexLabelPlacement: "inside",
//indexLabelOrientation: "vertical",
//indexLabelFontColor: "black",
//bevelEnabled: true,
type: "column",
showInLegend: true,
//axisYIndex: 0, //Defaults to Zero
name: "RQ Plan (MT)",
xValueFormatString: "####",
dataPoints: [
<%=HPMDataRQ_P%>
]
},
{
type: "column",
showInLegend: true,
axisYIndex: 1, //Defaults to Zero
name: "RQ Actual (MT)",
xValueFormatString: "####",
dataPoints: [
<%=HPMDataRQ_A%>
]
},
{
type: "spline",
lineDashType: "dash",
showInLegend: true,
axisYType: "secondary",
axisYIndex: 1, //Defaults to Zero
name: "RQ Plan (Pcs)",
xValueFormatString: "####",
dataPoints: [
<%=HPMDataPCs_P%>
]
},
{
type: "spline",
showInLegend: true,
axisYType: "secondary",
axisYIndex: 1, //When axisYType is secondary, axisYIndex indexes to secondary Y axis & not to primary Y axis
name: "RQ Actual (Pcs)",
xValueFormatString: "####",
dataPoints: [
<%=HPMDataPCs_A%>
]
}
]
});
chart.render();
}
</script>
<% } %>
window.onload=函数(){
var chart=new CanvasJS.chart(“chartContainer”{
主题:“主题3”,
//交互式启用:正确,
animationEnabled:没错,
动画持续时间:2000,//更改为1000、500等
可缩放:对,
标题:{
文本:“HPM轧制数量()”
},
工具提示:{
enabled:true,//在此处禁用
animationEnabled:true//在此处禁用
},
exportFileName:“HPM RQ报告”//相应地给出任何名称
exportEnabled:true,
axisX:{
valueFormatString:“####”,
间隔时间:1
},
axisY:[{
标题:“RQ(吨)”,
线条颜色:“#369EAD”,
标题字体颜色:“#369EAD”,
labelFontColor:#369EAD“,
},
],
axisY2:[{
标题:“RQ(Pcs)”,
线条颜色:“7F6084”,
标题字体颜色:“7F6084”,
labelFontColor:#7F6084“
},
],
数据:[
{
//索引标签:“{y}”,
//indexLabelPlacement:“内部”,
//indexLabelOrientation:“垂直”,
//indexLabelFontColor:“黑色”,
//是的,
键入:“列”,
showInLegend:是的,
//axisYIndex:0,//默认为零
名称:“RQ计划(MT)”,
xValueFormatString:“#####”,
数据点:[
]
},
{
键入:“列”,
showInLegend:是的,
axisYIndex:1,//默认为零
名称:“RQ实际(MT)”,
xValueFormatString:“#####”,
数据点:[
]
},
{
类型:“样条曲线”,
lineDashType:“破折号”,
showInLegend:是的,
axisYType:“次要”,
axisYIndex:1,//默认为零
名称:“RQ计划(Pcs)”,
xValueFormatString:“#####”,
数据点:[
]
},
{
类型:“样条曲线”,
showInLegend:是的,
axisYType:“次要”,
axisYIndex:1,//当axisYType为次类型时,axisYIndex索引到次Y轴&而不是主Y轴
名称:“RQ实际(Pcs)”,
xValueFormatString:“#####”,
数据点:[
]
}
]
});
chart.render();
}
<% if (!IsPostBack)
{ %>
<script type="text/javascript">
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
theme: "theme3",
//interactivityEnabled: true,
animationEnabled: true,
animationDuration: 2000, //change to 1000, 500 etc
zoomEnabled: true,
title: {
text: "HPM Rolled Quantity (<%= String.Format("{0:MMMM}", DateTime.Now) %> <%= DateTime.Now.Year.ToString() %>)"
},
toolTip: {
enabled: true, //disable here
animationEnabled: true //disable here
},
exportFileName: "HPM RQ Report", //Give any name accordingly
exportEnabled: true,
axisX: {
valueFormatString: "####",
interval: 1
},
axisY: [{
title: "RQ (Ton)",
lineColor: "#369EAD",
titleFontColor: "#369EAD",
labelFontColor: "#369EAD",
},
],
axisY2: [{
title: "RQ (Pcs)",
lineColor: "#7F6084",
titleFontColor: "#7F6084",
labelFontColor: "#7F6084"
},
],
data: [
{
//indexLabel: "{y}",
//indexLabelPlacement: "inside",
//indexLabelOrientation: "vertical",
//indexLabelFontColor: "black",
//bevelEnabled: true,
type: "column",
showInLegend: true,
//axisYIndex: 0, //Defaults to Zero
name: "RQ Plan (MT)",
xValueFormatString: "####",
dataPoints: [
<%=HPMDataRQ_P%>
]
},
{
type: "column",
showInLegend: true,
axisYIndex: 1, //Defaults to Zero
name: "RQ Actual (MT)",
xValueFormatString: "####",
dataPoints: [
<%=HPMDataRQ_A%>
]
},
{
type: "spline",
lineDashType: "dash",
showInLegend: true,
axisYType: "secondary",
axisYIndex: 1, //Defaults to Zero
name: "RQ Plan (Pcs)",
xValueFormatString: "####",
dataPoints: [
<%=HPMDataPCs_P%>
]
},
{
type: "spline",
showInLegend: true,
axisYType: "secondary",
axisYIndex: 1, //When axisYType is secondary, axisYIndex indexes to secondary Y axis & not to primary Y axis
name: "RQ Actual (Pcs)",
xValueFormatString: "####",
dataPoints: [
<%=HPMDataPCs_A%>
]
}
]
});
chart.render();
}
</script>
<% } %>