【发布时间】:2012-10-02 08:07:34
【问题描述】:
我有这样的看法:
<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) 的视图。 我不知道该怎么做。请问有什么帮助吗?
谢谢
【问题讨论】: