我写它打印这是由它通过JavaScript渲染点击一个按钮触发了DOM的某一区域的功能请参见下面的代码...获得“未捕获的SyntaxError:意外的标记}
function MarkQuiz() {
var CorrectAnswers = 0,
TotalQuestions = 0,
CurrentQuestion = "",
Percentage = 0,
Output = "";
$("select").each(function(key,value) {
CurrentQuestion = "#" + $(value).attr("id");
TotalQuestions = key + 1;
if($(CurrentQuestion).val() == "Correct") {
CorrectAnswers++;
}
});
Percentage = (CorrectAnswers/TotalQuestions) * 100;
Output = "You Scored..." +
"<h1>"+Percentage+"%</h1>" +
"Which means you got " + CorrectAnswers + " out of " + TotalQuestions + " correct.<br/>" +
"<br/><a href='#' onclick='PrintCertificate('#QuizMainContent')' class='button' id='PrintCertificate'>Print your Certificate</a>";
$("#QuizMainContent").html(Output);
}
function PrintCertificate(DOMArea) {
var PrintArea = $(DOMArea),
PrintWindow = window.open('','');
PrintWindow.document.write($(PrintArea).html());
PrintWindow.document.close();
PrintWindow.focus();
PrintWindow.print();
PrintWindow.close();
}
这是URL到项目:http://historicalperiods.esy.es/
我在做什么错在ADVA 谢谢NCE。
好心分享URL,因为它不是文件的问题,但带有URL –
那么,当你点击它提供给你的方便链接时会出现什么代码? –
错误消息说错误来自不同的文件。点击控制台中的链接转到该文件。 – Quentin