我有这样的看法:
<script type="text/javascript" src='<%: Url.Content("~/Scripts/new.js") %>'></script>
<div class="col1">
Number of Questions:
</div>
<div class="col2-input" id="no-of-questions-value">
<input type="hidden" name="NumberOfQuestionsHidden" id="NumberOfQuestionsHidden" value="<%: Model.NumberOfQuestions %>" />
<%: Html.TextBoxFor(model => model.NumberOfQuestions) %>
</div>
<div class="col3">
<div id="save-no-of-questions-button">
<a href="javascript:saveNoOfQuestions();" class="button">Save</a>
</div>
</div>
以及我确定值的new.js:这个js运行一个scorm模块并在我检查scorm模块中的问题时记录每个事件,我计算所有正确和所有不正确然后我知道问了多少问题。
function LogEvent(action,data)
{
if (data == "correct") {
correct_count++;
alert("incorrect count = " + incorrect_count + " correct count = " + correct_count);
}
if (data == "incorrect") {
incorrect_count++;
alert("incorrect count = " + incorrect_count + " correct count = " + correct_count);
}
}
为了得到问题的总数,我添加了正确的计数和不正确的计数,并希望将其传递给视图到 Html.TextBoxFor(model => model.NumberOfQuestions)。我不知道该怎么做。请问有什么帮助吗?
谢谢