Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Iframe Generator</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
} | |
#iframe-container { | |
margin-top: 20px; | |
} | |
iframe { | |
width: 100%; | |
height: 500px; | |
margin-bottom: 10px; | |
border: 1px solid #ddd; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>Iframe Generator</h2> | |
<input type="text" id="urlInput" placeholder="Enter URL"> | |
<input type="number" id="countInput" placeholder="Number of iframes"> | |
<button onclick="generateIframes()">Generate Iframes</button> | |
<div id="iframe-container"></div> | |
<script> | |
function generateIframes() { | |
const url = document.getElementById('urlInput').value; | |
const count = parseInt(document.getElementById('countInput').value); | |
const container = document.getElementById('iframe-container'); | |
// Clear existing iframes | |
container.innerHTML = ''; | |
if (url && count > 0) { | |
for (let i = 0; i < count; i++) { | |
const iframe = document.createElement('iframe'); | |
iframe.src = url; | |
container.appendChild(iframe); | |
} | |
} else { | |
alert('Please enter a valid URL and iframe count.'); | |
} | |
} | |
</script> | |
</body> | |
</html> |