如何为asp变量设置javascript代码值? 在以下代码中标题:'<%= Zaman%>',部分<%if if = =#34; buhafta"然后%> 给出一个空结果。我必须做些什么来确保没有空的结果。
<script>
function getWeekNumber(d) {
// Copy date so don't modify original
d = new Date(+d);
d.setHours(0,0,0,0);
// Set to nearest Thursday: current date + 4 - current day number
// Make Sunday's day number 7
d.setDate(d.getDate() + 4 - (d.getDay()||7));
// Get first day of year
var yearStart = new Date(d.getFullYear(),0,1);
// Calculate full weeks to nearest Thursday
var weekNo = Math.ceil(( ( (d - yearStart) / 86400000) + 1)/7);
// Return array of year and week number
return [d.getFullYear(), weekNo];
}
var result = getWeekNumber(new Date());
</script>
<%Dim Zaman
if act="bugun" then%>
<%Zaman=date()%>
<%end if%>
<%if act="dun" then%>
<%Zaman=date()-1%>
<%end if%>
<%if act="" OR act="buay" then%>
<%Zaman=(monthname(month(date)) & (" / ") & (year(date)))%>
<%end if%>
<%if act="oncekiay" and NOT operatorGor.eof then%>
<%Zaman=(monthname(month(operatorGor(4)))& (" / ") &(year(date)))%>
<%end if%>
<%if act="buhafta" then%>
<%Zaman=Response.Write("<script type=""text/javascript"">document.write(result[0] + '- ' + result[1] +'. hafta');</script>") %>
<%end if%>
<%if act="gecenhafta" then%>
<%Zaman=Response.Write("<script type=""text/javascript"">document.write(result[0] + '- ' + (result[1]-1) +'. hafta');</script>") %>
<%end if%>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawAnnotations);
function drawAnnotations() {
var data = google.visualization.arrayToDataTable([
['Operatörler', 'Operator Performansları', {type: 'string', role: 'annotation'}],
<%do while not operatorGor.eof%>
['<%=operatorGor(0)%> (<%=operatorGor(2)%> Saatte, <%=operatorGor(4)%> Farklı Tipte, <%=operatorGor(3)%> Parça)' , <%=operatorGor(1)%>, '%' + <%=operatorGor(1)%>],
<%operatorGor.MoveNext:loop%>
]);
var options = {
title: '<%=Zaman%>',
chartArea: {width: '30%'},
annotations: {
alwaysOutside: true,
textStyle: {
fontSize: 10,
auraColor: 'none',
color: '#555'
},
boxStyle: {
stroke: '#ccc',
strokeWidth: 1,
gradient: {
color1: '#f3e5f5',
color2: '#f3e5f5',
x1: '0%', y1: '0%',
x2: '100%', y2: '100%'
}
}
},
hAxis: {
title: 'Rework-Setup süreleri dahil değildir.',
minValue: 0,
},
vAxis: {
title: 'Toplam Operatör Sayısı:<%=CInt(opsay(0))-1%>'
}
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div style="width: 90%; border:2px solid #000; padding:5px; background-color:#fff; margin-left:auto; margin-right:auto">
<div id="chart_div" style="width: 100%; height: 700px; font-size:10px"></div>
</div>