https://github.com/hootanht/print
https://github.com/hootanht/print
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hootanht/print
- Owner: hootanht
- Created: 2023-06-21T14:58:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-18T20:11:16.000Z (almost 2 years ago)
- Last Synced: 2025-02-03T00:27:28.578Z (9 months ago)
- Language: HTML
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```markdown
# HTML Document with JavaScript Redirection## Introduction
This is a simple HTML document with a JavaScript script that redirects the user to another page after a specific timeout.## HTML Structure
```html
Document
// Set a timeout of 10 seconds (10,000 milliseconds)
setTimeout(function () {
// Redirect to 'page2.html'
window.location.href = 'page2.html';
}, 10000);
```
## Explanation
1. **DOCTYPE and HTML Tag**
- ``: Specifies the HTML version being used.
- ``: Defines the root of the HTML document with the language set to English.2. **Head Section**
- ``: Contains meta-information about the HTML document.
- ``: Specifies the character encoding.
- ``: Sets the viewport for responsive design.
- `Document`: Sets the title of the document.3. **Body Section**
- ``: Contains the content of the HTML document.
- ``: Introduces a block of JavaScript code.
- `setTimeout`: Executes a function after a specified timeout.
- The function changes the window location to 'page2.html' after 10 seconds (10,000 milliseconds).## Usage
1. Copy the HTML code provided.
2. Create a new HTML file in your preferred text editor.
3. Paste the copied code into the file.
4. Save the file with an appropriate name (e.g., `index.html`).
5. Open the file in a web browser.
6. After 10 seconds, the page will automatically redirect to 'page2.html'.
```Feel free to customize the guide further based on your specific needs or add more details as necessary.