diff --git a/files/en-us/learn/html/multimedia_and_embedding/other_embedding_technologies/index.md b/files/en-us/learn/html/multimedia_and_embedding/other_embedding_technologies/index.md index 26ccc828be58942..b19543e46759cf4 100644 --- a/files/en-us/learn/html/multimedia_and_embedding/other_embedding_technologies/index.md +++ b/files/en-us/learn/html/multimedia_and_embedding/other_embedding_technologies/index.md @@ -123,10 +123,10 @@ body { ``` ```js hidden -const textarea = document.getElementById('code'); -const reset = document.getElementById('reset'); -const solution = document.getElementById('solution'); -const output = document.querySelector('.output'); +const textarea = document.getElementById("code"); +const reset = document.getElementById("reset"); +const solution = document.getElementById("solution"); +const output = document.querySelector(".output"); let code = textarea.value; let userEntry = textarea.value; @@ -134,38 +134,39 @@ function updateCode() { output.innerHTML = textarea.value; } -reset.addEventListener('click', function() { +reset.addEventListener("click", function () { textarea.value = code; userEntry = textarea.value; solutionEntry = htmlSolution; - solution.value = 'Show solution'; + solution.value = "Show solution"; updateCode(); }); -solution.addEventListener('click', function() { - if (solution.value === 'Show solution') { +solution.addEventListener("click", function () { + if (solution.value === "Show solution") { textarea.value = solutionEntry; - solution.value = 'Hide solution'; + solution.value = "Hide solution"; } else { textarea.value = userEntry; - solution.value = 'Show solution'; + solution.value = "Show solution"; } updateCode(); }); -const htmlSolution = '\n\n'; +const htmlSolution = + '\n\n'; let solutionEntry = htmlSolution; -textarea.addEventListener('input', updateCode); -window.addEventListener('load', updateCode); +textarea.addEventListener("input", updateCode); +window.addEventListener("load", updateCode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead -textarea.onkeydown = function(e){ +textarea.onkeydown = function (e) { if (e.keyCode === 9) { e.preventDefault(); - insertAtCaret('\t'); + insertAtCaret("\t"); } if (e.keyCode === 27) { @@ -178,7 +179,10 @@ function insertAtCaret(text) { let caretPos = textarea.selectionStart; const front = textarea.value.substring(0, caretPos); - const back = textarea.value.substring(textarea.selectionEnd, textarea.value.length); + const back = textarea.value.substring( + textarea.selectionEnd, + textarea.value.length + ); textarea.value = front + text + back; caretPos += text.length; textarea.selectionStart = caretPos; @@ -189,10 +193,10 @@ function insertAtCaret(text) { // Update the saved userCode every time the user updates the text area code -textarea.onkeyup = function(){ +textarea.onkeyup = function () { // We only want to save the state when the user code is being shown, // not the solution, so that solution is not saved over the user code - if (solution.value === 'Show solution') { + if (solution.value === "Show solution") { userEntry = textarea.value; } else { solutionEntry = textarea.value; @@ -206,9 +210,11 @@ textarea.onkeyup = function(){ ## iframes in detail -So, that was easy and fun, right? {{htmlelement("iframe")}} elements are designed to allow you to embed other web documents into the current document. This is great for incorporating third-party content into your website that you might not have direct control over and don't want to have to implement your own version of — such as video from online video providers, commenting systems like [Disqus](https://disqus.com/), maps from online map providers, advertising banners, etc. The live editable examples you've been using through this course are implemented using `