我有两个变量,例如:
<script language="javascript" type="text/javascript">
var count = 1;
calc_my_project_ + count = Math.round( count * 268 / 100); // It shoud be calc_my_project_1 and next time it shoud be calc_my_project_2
count += count + 1;
</script>
现在结果是 calc_my_project_ + count 。我怎样才能做到这一点 ?
编辑:这是我的主要代码:
<script language="javascript" type="text/javascript">
var count = 1;
var str = 'calc_my_project_';
var str2 = 'my_pro_';
var result = str + count;
result = Math.round( @Html.DisplayFor(x => item.ProgressPercent) * 268 / 100);
var secresult = str2 + count;
secresult = "-" + result + "px 0";
var jq3 = jQuery.noConflict();
jq3(document).ready(function () {
jq3("#bar-pro-@barcount1st").css({ "background-position": secresult });
if (@Html.DisplayFor(x => item.ProgressPercent) == 100) {
jq3("#bar-pro-@barcount1st").css({ "background-image": "none" });
jq3("#bar-pro-@barcount2st").css({ "background-image": "none" });
};
});
count++;
</script>
result 和 secresult 返回一个固定值,我不想这样。