é åºãªããªã¹ãã¯ãè²·ãç©ãªã¹ãã«ä½¿ãã¨ãã®ããã«ãé
ç®ã®ä¸¦ã³ã«é¢ä¿ããªããã®ã«ã¤ãã¦ãã¼ã¯ã¢ããããã¨ãã«ä½¿ãã¾ãã
milk
eggs
bread
hummus
ãã¹ã¦ã®é åºãªããªã¹ã㯠<ul> ã§éå§ãããã¹ã¦ã®ãªã¹ãã®é
ç®ãå²ã¿ã¾ãã
<ul>
milk
eggs
bread
hummus
</ul>
æå¾ã«ãªã¹ãã®é
ç®ããããã <li> (list item)ã§å²ã¿ã¾ãã
<ul>
<li>milk</li>
<li>eggs</li>
<li>bread</li>
<li>hummus</li>
</ul>
ã¢ã¯ãã£ãã©ã¼ãã³ã°: é åºãªããªã¹ãã®ãã¼ã¯ã¢ãã
èªåã® HTML é åºãªããªã¹ããä½ãããã«ä¸ã®ã©ã¤ããµã³ãã«ãç·¨éãã¦ã¿ã¾ãããã
<h2>ã©ã¤ãåºå</h2>
<div class="output" style="min-height: 50px;"></div>
<h2>ç·¨éå¯è½ãªã³ã¼ã</h2>
<p class="a11y-label">
Esc ãæ¼ãã¨ã³ã¼ãé åãããã©ã¼ã«ã¹ãç§»åããããã¨ãã§ãã¾ãï¼Tab ã¯ã¿ãæåãæ¿å
¥ãã¾ãï¼ã
</p>
<textarea id="code" class="input" style="min-height: 100px; width: 95%">
milk
eggs
bread
hummus
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="ãªã»ãã" />
<input id="solution" type="button" value="çãã表示" />
</div>
html {
font-family: sans-serif;
}
h2 {
font-size: 16px;
}
.a11y-label {
margin: 0;
text-align: right;
font-size: 0.7rem;
width: 98%;
}
body {
margin: 10px;
background: #f5f9fa;
}
const textarea = document.getElementById("code");
const reset = document.getElementById("reset");
const solution = document.getElementById("solution");
const output = document.querySelector(".output");
const code = textarea.value;
let userEntry = textarea.value;
function updateCode() {
output.innerHTML = textarea.value;
}
const htmlSolution =
"<ul>\n<li>milk</li>\n<li>eggs</li>\n<li>bread</li>\n<li>hummus</li>\n</ul>";
let solutionEntry = htmlSolution;
reset.addEventListener("click", () => {
textarea.value = code;
userEntry = textarea.value;
solutionEntry = htmlSolution;
solution.value = "çãã表示";
updateCode();
});
solution.addEventListener("click", () => {
if (solution.value === "çãã表示") {
textarea.value = solutionEntry;
solution.value = "çããé ã";
} else {
textarea.value = userEntry;
solution.value = "çãã表示";
}
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 = (e) => {
if (e.code === "Tab") {
e.preventDefault();
insertAtCaret("\t");
}
if (e.code === "Escape") {
textarea.blur();
}
};
function insertAtCaret(text) {
const scrollPos = textarea.scrollTop;
let caretPos = textarea.selectionStart;
const front = textarea.value.substring(0, caretPos);
const back = textarea.value.substring(
textarea.selectionEnd,
textarea.value.length,
);
textarea.value = front + text + back;
caretPos += text.length;
textarea.selectionStart = caretPos;
textarea.selectionEnd = caretPos;
textarea.focus();
textarea.scrollTop = scrollPos;
}
// Update the saved userCode every time the user updates the text area code
textarea.onkeyup = () => {
// 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 === "çãã表示") {
userEntry = textarea.value;
} else {
solutionEntry = textarea.value;
}
updateCode();
};
é åºä»ããªã¹ãã¯ã以ä¸ã®ãããªä¸é£ã®æç¤ºã®ããã«ãé
ç®ã«é åºããããªã¹ãã®ãã¨ã§ãã
Drive to the end of the road
Turn right
Go straight across the first two roundabouts
Turn left at the third roundabout
The school is on your right, 300 meters up the road
ãã¼ã¯ã¢ããã®æ§é ã¯é åºãªããªã¹ãã¨åãã§ããéãã®ã¯ã<ul> ã®ä»£ããã« <ol> è¦ç´ ã§ãªã¹ãã®é
ç®ãå²ãå¿
è¦ããããã¨ã§ãã
<ol>
<li>Drive to the end of the road</li>
<li>Turn right</li>
<li>Go straight across the first two roundabouts</li>
<li>Turn left at the third roundabout</li>
<li>The school is on your right, 300 meters up the road</li>
</ol>
ã¢ã¯ãã£ãã©ã¼ãã³ã°: é åºã¤ããªã¹ãããã¼ã¯ã¢ãããã
èªèº«ã® HTML é åºã¤ããªã¹ããä½ãããã«ä¸ã®ã©ã¤ããµã³ãã«ãç·¨éãã¦ã¿ã¾ãããã
<h2>ã©ã¤ãåºå</h2>
<div class="output" style="min-height: 50px;"></div>
<h2>ç·¨éå¯è½ãªã³ã¼ã</h2>
<p class="a11y-label">
Esc ãæ¼ãã¨ã³ã¼ãé åãããã©ã¼ã«ã¹ãç§»åããããã¨ãã§ãã¾ãï¼Tab ã¯ã¿ãæåãæ¿å
¥ãã¾ãï¼ã
</p>
<textarea id="code" class="input" style="min-height: 200px; width: 95%">
Drive to the end of the road
Turn right
Go straight across the first two roundabouts
Turn left at the third roundabout
The school is on your right, 300 meters up the road
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="ãªã»ãã" />
<input id="solution" type="button" value="çãã表示" />
</div>
html {
font-family: sans-serif;
}
h2 {
font-size: 16px;
}
.a11y-label {
margin: 0;
text-align: right;
font-size: 0.7rem;
width: 98%;
}
body {
margin: 10px;
background: #f5f9fa;
}
const textarea = document.getElementById("code");
const reset = document.getElementById("reset");
const solution = document.getElementById("solution");
const output = document.querySelector(".output");
const code = textarea.value;
let userEntry = textarea.value;
function updateCode() {
output.innerHTML = textarea.value;
}
const htmlSolution =
"<ol>\n<li>Drive to the end of the road</li>\n<li>Turn right</li>\n<li>Go straight across the first two roundabouts</li>\n<li>Turn left at the third roundabout</li>\n<li>The school is on your right, 300 meters up the road</li>\n</ol>";
let solutionEntry = htmlSolution;
reset.addEventListener("click", () => {
textarea.value = code;
userEntry = textarea.value;
solutionEntry = htmlSolution;
solution.value = "çãã表示";
updateCode();
});
solution.addEventListener("click", () => {
if (solution.value === "çãã表示") {
textarea.value = solutionEntry;
solution.value = "çããé ã";
} else {
textarea.value = userEntry;
solution.value = "çãã表示";
}
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 = (e) => {
if (e.code === "Tab") {
e.preventDefault();
insertAtCaret("\t");
}
if (e.code === "Escape") {
textarea.blur();
}
};
function insertAtCaret(text) {
const scrollPos = textarea.scrollTop;
let caretPos = textarea.selectionStart;
const front = textarea.value.substring(0, caretPos);
const back = textarea.value.substring(
textarea.selectionEnd,
textarea.value.length,
);
textarea.value = front + text + back;
caretPos += text.length;
textarea.selectionStart = caretPos;
textarea.selectionEnd = caretPos;
textarea.focus();
textarea.scrollTop = scrollPos;
}
// Update the saved userCode every time the user updates the text area code
textarea.onkeyup = () => {
// 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 === "çãã表示") {
userEntry = textarea.value;
} else {
solutionEntry = textarea.value;
}
updateCode();
};
ãã®è¨äºã®ãã®æç¹ã§ãã¬ã·ããã¼ã¸ã®ä¾ããã¼ã¯ã¢ããããããã«å¿
è¦ãªæ
å ±ã¯ãã¹ã¦æã£ã¦ãã¾ããtext-start.html ãã¡ã¤ã«ã®å§ãã®ãã¼ã«ã«ã³ãã¼ãä¿åãã¦ããã§ä½æ¥ãè¡ãããã¾ãã¯ä¸è¨ã®ç·¨éå¯è½ãªä¾ã§å®è¡ãããã鏿ã§ãã¾ããç·¨éããä¾ã«è¨å
¥ããã¨ã次ã«ãã¼ã¸ãéããã¨ãã«å¤±ãããããããã¼ã«ã«ã§å®è¡ããã®ãããããããããã§ããããã©ã¡ãã«ãé·æã¨çæãããã¾ãã
<h2>ã©ã¤ãåºå</h2>
<div class="output" style="min-height: 50px;"></div>
<h2>ç·¨éå¯è½ãªã³ã¼ã</h2>
<p class="a11y-label">
Esc ãæ¼ãã¨ã³ã¼ãé åãããã©ã¼ã«ã¹ãç§»åããããã¨ãã§ãã¾ãï¼Tab ã¯ã¿ãæåãæ¿å
¥ãã¾ãï¼ã
</p>
<textarea id="code" class="input" style="min-height: 200px; width: 95%">
Quick hummus recipe
This recipe makes quick, tasty hummus, with no messing. It has been adapted from a number of different recipes that I have read over the years.
Hummus is a delicious thick paste used heavily in Greek and Middle Eastern dishes. It is very tasty with salad, grilled meats and pitta breads.
Ingredients
1 can (400g) of chick peas (garbanzo beans)
175g of tahini
6 sundried tomatoes
Half a red pepper
A pinch of cayenne pepper
1 clove of garlic
A dash of olive oil
Instructions
Remove the skin from the garlic, and chop coarsely
Remove all the seeds and stalk from the pepper, and chop coarsely
Add all the ingredients into a food processor
Process all the ingredients into a paste
If you want a coarse "chunky" hummus, process it for a short time
If you want a smooth hummus, process it for a longer time
For a different flavor, you could try blending in a small measure of lemon and coriander, chili pepper, lime and chipotle, harissa and mint, or spinach and feta cheese. Experiment and see what works for you.
Storage
Refrigerate the finished hummus in a sealed container. You should be able to use it for about a week after you've made it. If it starts to become fizzy, you should definitely discard it.
Hummus is suitable for freezing; you should thaw it and use it within a couple of months.
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="ãªã»ãã" />
<input id="solution" type="button" value="çãã表示" />
</div>
html {
font-family: sans-serif;
}
h2 {
font-size: 16px;
}
.a11y-label {
margin: 0;
text-align: right;
font-size: 0.7rem;
width: 98%;
}
body {
margin: 10px;
background: #f5f9fa;
}
const textarea = document.getElementById("code");
const reset = document.getElementById("reset");
const solution = document.getElementById("solution");
const output = document.querySelector(".output");
const code = textarea.value;
let userEntry = textarea.value;
function updateCode() {
output.innerHTML = textarea.value;
}
const htmlSolution =
'<h1>Quick hummus recipe</h1>\n\n<p>This recipe makes quick, tasty hummus, with no messing. It has been adapted from a number of different recipes that I have read over the years.</p>\n\n<p>Hummus is a delicious thick paste used heavily in Greek and Middle Eastern dishes. It is very tasty with salad, grilled meats and pitta breads.</p>\n\n<h2>Ingredients</h2>\n\n<ul>\n<li>1 can (400g) of chick peas (garbanzo beans)</li>\n<li>175g of tahini</li>\n<li>6 sundried tomatoes</li>\n<li>Half a red pepper</li>\n<li>A pinch of cayenne pepper</li>\n<li>1 clove of garlic</li>\n<li>A dash of olive oil</li>\n</ul>\n\n<h2>Instructions</h2>\n\n<ol>\n<li>Remove the skin from the garlic, and chop coarsely.</li>\n<li>Remove all the seeds and stalk from the pepper, and chop coarsely.</li>\n<li>Add all the ingredients into a food processor.</li>\n<li>Process all the ingredients into a paste.</li>\n<li>If you want a coarse "chunky" hummus, process it for a short time.</li>\n<li>If you want a smooth hummus, process it for a longer time.</li>\n</ol>\n\n<p>For a different flavor, you could try blending in a small measure of lemon and coriander, chili pepper, lime and chipotle, harissa and mint, or spinach and feta cheese. Experiment and see what works for you.</p>\n\n<h2>Storage</h2>\n\n<p>Refrigerate the finished hummus in a sealed container. You should be able to use it for about a week after you\'ve made it. If it starts to become fizzy, you should definitely discard it.</p>\n\n<p>Hummus is suitable for freezing; you should thaw it and use it within a couple of months.</p>';
let solutionEntry = htmlSolution;
reset.addEventListener("click", () => {
textarea.value = code;
userEntry = textarea.value;
solutionEntry = htmlSolution;
solution.value = "çãã表示";
updateCode();
});
solution.addEventListener("click", () => {
if (solution.value === "çãã表示") {
textarea.value = solutionEntry;
solution.value = "çããé ã";
} else {
textarea.value = userEntry;
solution.value = "çãã表示";
}
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 = (e) => {
if (e.code === "Tab") {
e.preventDefault();
insertAtCaret("\t");
}
if (e.code === "Escape") {
textarea.blur();
}
};
function insertAtCaret(text) {
const scrollPos = textarea.scrollTop;
let caretPos = textarea.selectionStart;
const front = textarea.value.substring(0, caretPos);
const back = textarea.value.substring(
textarea.selectionEnd,
textarea.value.length,
);
textarea.value = front + text + back;
caretPos += text.length;
textarea.selectionStart = caretPos;
textarea.selectionEnd = caretPos;
textarea.focus();
textarea.scrollTop = scrollPos;
}
// Update the saved userCode every time the user updates the text area code
textarea.onkeyup = () => {
// 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 === "çãã表示") {
userEntry = textarea.value;
} else {
solutionEntry = textarea.value;
}
updateCode();
};
ç«ã¡å¾çããå ´åã¯ããã¤ã§ã [çãã表示] ãã¿ã³ãæ¼ãããGitHub ãªãã¸ããªã¼ã® text-complete.html ã®ä¾ãè¦ããã¨ãã§ãã¾ãã
ãããªã¹ããå¥ã®ãªã¹ãã®ä¸ã«å
¥ãåã«ãã¦ãã¾ã£ããåé¡ããã¾ãããããã¤ãã®ãµãç®æ¡æ¸ããæä¸ä½ã®ç®æ¡æ¸ãã®ä¸ã«é
ç½®ãããã¨ããå§ããã¾ãã ã¬ã·ãã®ä¾ãã 2 çªç®ã®ãªã¹ããè¦ã¦ã¿ã¾ãããã
<ol>
<li>Remove the skin from the garlic, and chop coarsely.</li>
<li>Remove all the seeds and stalk from the pepper, and chop coarsely.</li>
<li>Add all the ingredients into a food processor.</li>
<li>Process all the ingredients into a paste.</li>
<li>If you want a coarse "chunky" hummus, process it for a short time.</li>
<li>If you want a smooth hummus, process it for a longer time.</li>
</ol>
æå¾ã® 2 ã¤ã®ç®æ¡æ¸ãã¯ãããã®åã®ç®æ¡æ¸ãã¨é常ã«å¯æ¥ã«é¢ä¿ãã¦ããã®ã§ï¼ãããã¯ãã®ç®æ¡æ¸ãã®ä¸ã«åã¾ããµãå½ä»¤ã鏿ã®ããã«èªã¿ã¾ãï¼ãããããèªèº«ã®é åºãªããªã¹ãã®ä¸ã«å
¥ãåã«ãã¦ç¾å¨ã®ãªã¹ãã®ä¸ã«å
¥ãããã¨ã¯æå³ãããã¾ãã4 çªç®ã®ç®æ¡æ¸ãã ããã¯æ¬¡ã®ããã«ãªãã¾ãã
<ol>
<li>Remove the skin from the garlic, and chop coarsely.</li>
<li>Remove all the seeds and stalk from the pepper, and chop coarsely.</li>
<li>Add all the ingredients into a food processor.</li>
<li>
Process all the ingredients into a paste.
<ul>
<li>
If you want a coarse "chunky" hummus, process it for a short time.
</li>
<li>If you want a smooth hummus, process it for a longer time.</li>
</ul>
</li>
</ol>
åã®ã¢ã¯ãã£ãã©ã¼ãã³ã°ã®ä¾ã«æ»ãã2 çªç®ã®ãªã¹ããæ¬¡ã®ããã«æ´æ°ãã¦ã¿ã¦ãã ããã
説æãªã¹ãã®ç®çã¯ãã¢ã¤ãã ã¨ããã«é¢é£ä»ãããã説æï¼ç¨èªãå®ç¾©ã質åã¨åçãªã©ï¼ããã¼ã¯ã¢ãããããã¨ã§ããä¾ãã°ãç¨èªã¨å®ç¾©ã®è¨å®ä¾ãè¦ã¦ããã¾ãããã
ç¬ãè¨ (soliloquy)
ãã©ãã§ãç»å ´äººç©ãèªåèªèº«ã«ããã¹ããããå
ãªãèããææ
ãããããªã£ãéç¨ãï¼ä»ã®ç»å ´äººç©ã§ã¯ãªãï¼è¦³å®¢ã«å¯¾ãã¦è¡¨ç¾ãããã®ã§ãã
ç¬ç½ (monologue)
ãã©ãã§ãç»å ´äººç©ãèªåã®èãã観客ãä»ã®ç»å ´äººç©ã«ä¼ããããã«åããã®ã§ãã
åç½ (aside)
ãã©ãã§ãç»å ´äººç©ã観客ã®ã¿ã«å¯¾ããã¦ã¼ã¢ã¢ããã©ãããã¯ãªå¹æãçã£ã¦ã³ã¡ã³ãããã¾ããããã¯éå¸¸ã¯ææ
ããèããã追å ã®èæ¯æ
å ±ã§ãã
説æãªã¹ãã¯ä»ã®ç¨®é¡ã®ãªã¹ãã¨ç°ãªãã©ããã¼ â <dl> ã使ãã¾ããããããã®ç¨èªã <dt> ï¼description termã説æç¨èªï¼è¦ç´ ã§å²ã¿ãããããã®èª¬æã¯ <dd> ï¼description definitionã説æå®ç¾©ï¼è¦ç´ ã§å²ã¿ã¾ãã
ä¾ããã¼ã¯ã¢ãããã¾ãããã
<dl>
<dt>ç¬ãè¨ (soliloquy)</dt>
<dd>
ãã©ãã§ãç»å ´äººç©ãèªåèªèº«ã«ããã¹ããããå
ãªãèããææ
ãããããªã£ãéç¨ãï¼ä»ã®ç»å ´äººç©ã§ã¯ãªãï¼è¦³å®¢ã«å¯¾ãã¦è¡¨ç¾ãããã®ã§ãã
</dd>
<dt>ç¬ç½ (monologue)</dt>
<dd>
ãã©ãã§ãç»å ´äººç©ãèªåã®èãã観客ãä»ã®ç»å ´äººç©ã«ä¼ããããã«åããã®ã§ãã
</dd>
<dt>åç½ (aside)</dt>
<dd>
ãã©ãã§ãç»å ´äººç©ã観客ã®ã¿ã«å¯¾ããã¦ã¼ã¢ã¢ããã©ãããã¯ãªå¹æãçã£ã¦ã³ã¡ã³ãããã¾ããããã¯éå¸¸ã¯ææ
ããèããã追å ã®èæ¯æ
å ±ã§ãã
</dd>
</dl>
ãã©ã¦ã¶ã¼ã®æ¢å®ã®ã¹ã¿ã¤ã«ã§ã¯ã説æãç¨èªããããããã¤ã³ãã³ããã¾ãã MDN ã®ã¹ã¿ã¤ã«ã¯ãã®æ
£ç¿ã«ã»ã¼å¾ãã¾ãããç¨èªã太åã«ãã¾ãã
ãªããä¾ãã°ãåä¸ã®ç¨èªã«è¤æ°ã®èª¬æãæããããã¨ãå¯è½ã§ãã
<dl>
<dt>åç½ (aside)</dt>
<dd>
ãã©ãã§ã¯ãç»å ´äººç©ã観客ã®ã¿ã«å¯¾ããã¦ã¼ã¢ã¢ããã©ãããã¯ãªå¹æãçã£ã¦ã³ã¡ã³ãããã¾ããããã¯éå¸¸ã¯ææ
ããèããã追å ã®èæ¯æ
å ±ã§ãã
</dd>
<dd>
æç« ã§ã¯ãç¾å¨ã®ãããã¯ã«é¢é£ããã³ã³ãã³ãã®ä¸é¨ã§ãããæ¬æã®æµãã«ç´æ¥åããªããããè¿ãã«è¡¨ç¤ºããã¾ãï¼å¤ãã®å ´åãæ¨ªã«ä¸¦ãã§ããæ ã®ä¸ã«å
¥ãã¾ãï¼ã
</dd>
</dl>
説æãªã¹ããä½ã£ã¦ã¿ã¾ããããå
¥åæ¬ã®çããã¹ãã«è¦ç´ ã追å ãã¦ãåºåæ¬ã«èª¬ææã®ãªã¹ãã¨ãã¦ç¾ããããã«ãã¾ãããããæã¿ãªããèªèº«ã®ç¨èªã説ææã使ç¨ãã¦ã¿ãã®ãããã§ãããã
ééãããã常㫠ãªã»ãã ãã¿ã³ã使ç¨ãã¦ãªã»ãããããã¨ãã§ãã¾ããæ¬å½ã«è¡ãè©°ã¾ã£ãããçãã表示 ãã¿ã³ãæ¼ãã¦ãçããè¦ããã¨ãã§ãã¾ãã
<h2>ã©ã¤ãåºå</h2>
<div class="output" style="min-height: 50px;"></div>
<h2>ç·¨éå¯è½ãªã³ã¼ã</h2>
<p class="a11y-label">
Esc ãæ¼ãã¨ã³ã¼ãé åãããã©ã¼ã«ã¹ãç§»åããããã¨ãã§ãã¾ãï¼Tab ã¯ã¿ãæåãæ¿å
¥ãã¾ãï¼ã
</p>
<textarea id="code" class="input" style="min-height: 100px; width: 95%">
Bacon
The glue that binds the world together.
Eggs
The glue that binds the cake together.
Coffee
The drink that gets the world running in the morning.
A light brown color.
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="ãªã»ãã" />
<input id="solution" type="button" value="çãã表示" />
</div>
html {
font-family: sans-serif;
}
h2 {
font-size: 16px;
}
.a11y-label {
margin: 0;
text-align: right;
font-size: 0.7rem;
width: 98%;
}
body {
margin: 10px;
background: #f5f9fa;
}
const textarea = document.getElementById("code");
const reset = document.getElementById("reset");
const solution = document.getElementById("solution");
const output = document.querySelector(".output");
const code = textarea.value;
let userEntry = textarea.value;
function updateCode() {
output.innerHTML = textarea.value;
}
const htmlSolution =
"<dl>\n <dt>Bacon</dt>\n <dd>The glue that binds the world together.</dd>\n <dt>Eggs</dt>\n <dd>The glue that binds the cake together.</dd>\n <dt>Coffee</dt>\n <dd>The drink that gets the world running in the morning.</dd>\n <dd>A light brown color.</dd>\n</dl>";
let solutionEntry = htmlSolution;
reset.addEventListener("click", () => {
textarea.value = code;
userEntry = textarea.value;
solutionEntry = htmlSolution;
solution.value = "çãã表示";
updateCode();
});
solution.addEventListener("click", () => {
if (solution.value === "çãã表示") {
textarea.value = solutionEntry;
solution.value = "çããé ã";
} else {
textarea.value = userEntry;
solution.value = "çãã表示";
}
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 = (e) => {
if (e.code === "Tab") {
e.preventDefault();
insertAtCaret("\t");
}
if (e.code === "Escape") {
textarea.blur();
}
};
function insertAtCaret(text) {
const scrollPos = textarea.scrollTop;
let caretPos = textarea.selectionStart;
const front = textarea.value.substring(0, caretPos);
const back = textarea.value.substring(
textarea.selectionEnd,
textarea.value.length,
);
textarea.value = front + text + back;
caretPos += text.length;
textarea.selectionStart = caretPos;
textarea.selectionEnd = caretPos;
textarea.focus();
textarea.scrollTop = scrollPos;
}
// Update the saved userCode every time the user updates the text area code
textarea.onkeyup = () => {
// 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 === "çãã表示") {
userEntry = textarea.value;
} else {
solutionEntry = textarea.value;
}
updateCode();
};
ãã®è¨äºã®æå¾ã«éãã¾ããããæã大åãªæ
å ±ãè¦ãã¦ãã¾ããï¼æ¬¡ã«é²ãåã«ããã®æ
å ±ã身ã«ä»ãããã©ããã確èªãããã¹ããããã¾ããã¹ãã«ãã¹ã: HTML ããã¹ãã®åºç¤ãè¦ã¦ãã ããã
ãªã¹ãã«ã¤ãã¦ã¯ä»¥ä¸ã§ããæ¬¡ã«ãããé«åº¦ãªè©±é¡ã«ç§»ãã¾ããç§ãã¡ã¯ãåã
ã®ãã¼ã¸æ©è½ã®å®è£
æ¹æ³ã表示ããã¦ãã¾ãããã HTML ãã¼ã¸å
¨ä½ã®æ§é åã«ã¤ãã¦ã¯ã©ãã§ããããï¼ æ¬¡ã¯ãææ¸ã®æ§é åã§ãã