O Level Exam : Practical Question
📝 HTML
🎨 CSS
⚡ Java Script
<!DOCTYPE html> <html> <head> <title>Anchor Tag Demonstration</title> </head> <body> <h2 id="top">Anchor Tag Examples</h2> <!-- a. Open PDF in new tab --> <p> <a href="sample.pdf" target="_blank">Open PDF in New Tab</a> </p> <!-- b. Download DOCX in same window --> <p> <a href="sample.docx" download>Download DOCX File</a> </p> <!-- Spacer for scrolling --> <p style="margin-top: 800px;">Scroll down...</p> <!-- c. Jump to Contact Us section --> <h2 id="contact">Contact Us</h2> <p> Email: example@example.com<br> Phone: 123-456-7890 </p> <!-- d. Jump back to top --> <p> <a href="#top">Back to Top</a> </p> </body> </html>
▶ Run Code
🖥 Output: