Вот мой код, на самом деле это так. работает нормально, только сертификат.pdf не открывается.
документ, из-за которого не удалось открыть сертификат
Мой код
Код: Выделить всё
Python For Beginner | Congratulations
*{
margin: 0;
padding: 0;
}
body {
background-color: #f0f0f0;
font-family: Arial, sans-serif;
}
.certificate {
width: 80%;
margin: 0 auto;
background-color: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
h1 {
margin-top: 20px;
font-family: 'Brush Script MT', cursive;
}
p {
margin-top: 20px;
font-family: 'Brush Script MT', cursive;
}
#display {
font-family: 'Brush Script MT', cursive;
font-size: 30px;
color: magenta;
margin-top: 20px;
}
button {
padding: 10px 20px;
margin-top: 30px;
font-size: 18px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
PYTHON FOR BEGINNER
Congratulations!
You Have Completed Your Python Course.
Download Certificate
function downloadCertificate() {
let userName = prompt("Please enter your name for the certificate:");
if (userName) {
let fileName = "Certificate_" + userName.replace(/\s+/g, '_') + ".pdf";
let certificateContent = "This is to certify that " + userName + " has successfully completed the Python for Beginner course.";
let blob = new Blob([certificateContent], { type: "application/pdf" });
let link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
let userName = prompt("What's Your Name?");
document.getElementById("display").innerHTML = "Name: " + userName;
Подробнее здесь: https://stackoverflow.com/questions/784 ... -it-is-not