yasserrmd commited on
Commit
fd71c00
1 Parent(s): 187d912

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +22 -2
index.html CHANGED
@@ -1,7 +1,7 @@
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
- <title>Sample Form</title>
5
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
6
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
7
  <style>
@@ -161,12 +161,13 @@ h2 {
161
  <div class="container" style="margin-top: 50px;">
162
  <form id="messageForm">
163
  <div class="input-group mb-3">
164
- <input type="text" class="form-control" id="messageInput" placeholder="Type your message here...">
165
  <!-- <textarea class="form-control" id="messageInput" placeholder="Type your message here..." rows="7"></textarea> -->
166
  <div class="input-group-append">
167
  <button class="btn btn-outline-secondary" type="submit" id="sendButton">
168
  <i id="buttonIcon" class="fas fa-paper-plane"></i>
169
  </button>
 
170
  </div>
171
  </div>
172
  </form>
@@ -193,6 +194,25 @@ h2 {
193
  iframe.style.height = document.getElementById('myIframe').contentWindow.document.body.scrollHeight + 'px';
194
 
195
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  $(document).ready(function() {
197
  $('#messageForm').on('submit', function(e) {
198
  e.preventDefault();
 
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
+ <title>WebGenUI - Web Page UI Generator</title>
5
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
6
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
7
  <style>
 
161
  <div class="container" style="margin-top: 50px;">
162
  <form id="messageForm">
163
  <div class="input-group mb-3">
164
+ <input type="text" class="form-control" id="messageInput" placeholder="Type your website details here...">
165
  <!-- <textarea class="form-control" id="messageInput" placeholder="Type your message here..." rows="7"></textarea> -->
166
  <div class="input-group-append">
167
  <button class="btn btn-outline-secondary" type="submit" id="sendButton">
168
  <i id="buttonIcon" class="fas fa-paper-plane"></i>
169
  </button>
170
+ <button id="downloadButton"><i class="fas fa-download"></i> Download HTML</button>
171
  </div>
172
  </div>
173
  </form>
 
194
  iframe.style.height = document.getElementById('myIframe').contentWindow.document.body.scrollHeight + 'px';
195
 
196
  }
197
+
198
+ document.getElementById('downloadButton').addEventListener('click', function() {
199
+ var iframeDoc = document.getElementById('myIframe').contentWindow.document;
200
+ if (iframeDoc.body.innerHTML.trim() !== '') {
201
+ var html = iframeDoc.documentElement.outerHTML;
202
+ var blob = new Blob([html], { type: 'text/html' });
203
+ var url = URL.createObjectURL(blob);
204
+ var a = document.createElement('a');
205
+ a.href = url;
206
+ a.download = 'output.html';
207
+ document.body.appendChild(a);
208
+ a.click();
209
+ document.body.removeChild(a);
210
+ URL.revokeObjectURL(url);
211
+ } else {
212
+ alert('No content to download.');
213
+ }
214
+ });
215
+
216
  $(document).ready(function() {
217
  $('#messageForm').on('submit', function(e) {
218
  e.preventDefault();