所以我有一个用户参加的测验,最后他们显然得到了结果。
有一个“打印结果”功能,客户端希望使用新的 css 等加载到新窗口中......
我的问题是,如何使用 JavaScript 将结果传递到新窗口?通常我会通过 session 来完成这一切,但测验和结果都是通过 JavaScript 完成的。
我基本上有这个:
$('#quizId .printQuiz').live("click", function(event) {
event.preventDefault();
resultsHtml = $('#quizResultsContent').html();
window.open('QuizResults.htm', "Print", "status=0,toolbar=0");
}
我需要将 resultsHtml 传递到 QuizResults.htm 页面。这可能吗?
最佳答案
您也可以直接写入窗口,不需要实际的页面:
<script type="text/javascript">
var w = window.open(null, '_blank');
w.document.open();
w.document.write('hello world');
w.document.close();
</script>
关于asp.net - 如何将动态生成的结果传递到打印友好的新窗口中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2120608/