新手 第9 课后题 请教
本帖最后由 williamso 于 2019-2-1 23:19 编辑保存为.txt 文本 。但 为什么 保存为.html 文件后 显示不同了--- 》 图1 {:10_266:}{:10_266:}
<!DOCTYPE html>
<html>
<head><title>课后作业</title>
<meta charset='utf-8'>
<link rel="stylesheet" href="css/fishc.css">
<style>
.note-content {
font-family: "Helvetica Neue", Arial, "Hiragino Sans GB", STHeiti, "Microsoft YaHei", "WenQuanYi Micro Hei", SimSun, Song, sans-serif;
}
</style>
</head>
<body>
<div id='preview-contents' class='note-content'>
<pre class="prettyprint hljs-dark"><code class="hljs xml"><div class="codeLine"><span class="hljs-meta"><!DOCTYPE html></span></div><div class="codeLine"><span class="codeTag"><<span class="codeName">html</span> <span class="hljs-attr">lang</span>=<span class="codeAttrValue">"en"</span>></span></div><div class="codeLine"><span class="codeTag"><<span class="codeName">head</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">charset</span>=<span class="codeAttrValue">"UTF-8"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">name</span>=<span class="codeAttrValue">"viewport"</span> <span class="hljs-attr">content</span>=<span class="codeAttrValue">"width=device-width, initial-scale=1.0"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">name</span>=<span class="codeAttrValue">"keywords"</span> <span class="hljs-attr">content</span>=<span class="codeAttrValue">"小甲鱼,Web开发,HTML5,CSS3,Web编程教学"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">name</span>=<span class="codeAttrValue">"description"</span> <span class="hljs-attr">content</span>=<span class="codeAttrValue">"《零基础入门学习Web开发》课后作业"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">name</span>=<span class="codeAttrValue">"author"</span> <span class="hljs-attr">content</span>=<span class="codeAttrValue">"鱼C工作室"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">title</span>></span>课后作业<span class="codeTag"></<span class="codeName">title</span>></span></div><div class="codeLine"> <span class="codeTag"></<span class="codeName">head</span>></span></div><div class="codeLine"><span class="codeTag"><<span class="codeName">body</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">p</span>></span>你最喜欢吃的水果是:<span class="codeTag"><<span class="codeName">span</span> <span class="hljs-attr">id</span>=<span class="codeAttrValue">"fruit"</span>></span> <span class="codeTag"></<span class="codeName">span</span>></span><span class="codeTag"></<span class="codeName">p</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">script</span>></span><span class="javascript"></span></div><div class="codeLine"><span class="javascript"> <span class="hljs-keyword">var</span> user_input = prompt(<span class="codeAttrValue">"你最喜欢吃的水果是:"</span>);</span></div><div class="codeLine"><span class="javascript"> <span class="hljs-built_in">document</span>.getElementById(<span class="codeAttrValue">"fruit"</span>).innerHTML = user_input;</span></div><div class="codeLine"><span class="javascript"></span> <span class="codeTag"></<span class="codeName">script</span>></span></div><div class="codeLine"><span class="codeTag"></<span class="codeName">body</span>></span></div><div class="codeLine"><span class="codeTag"></<span class="codeName">html</span>></span></div></code>
</pre>
</div>
</body>
</html>
哪里不同了
本帖最后由 williamso 于 2019-2-3 11:03 编辑
ABC23 发表于 2019-2-3 09:00
哪里不同了
开始 保存 txt ,转换 html 格式( 是不是 格式的问题 TXT 转换 HTML )
***************************************第 13 行 / 第 14行 保存 html 后 变成 短短的的这几行 图1
< pre clsaa="prettyprint hljs-dark"><code class="hljs xml"><div class="codeLine"><span class="hljs-meta"><,!DOCTYPE html></span></div><div class="codeLine"><span class="codeTag"><...................
</pre>
*************************保存 txt前一大段
<!DOCTYPE html>
<html>
<head><title>课后作业</title>
<meta charset='utf-8'>
<link rel="stylesheet" href="css/fishc.css">
<style>
.note-content {
font-family: "Helvetica Neue", Arial, "Hiragino Sans GB", STHeiti, "Microsoft YaHei", "WenQuanYi Micro Hei", SimSun, Song, sans-serif;
}
</style>
</head>
<body>
<div id='preview-contents' class='note-content'>
<pre class="prettyprint hljs-dark"><code class="hljs xml"><div class="codeLine"><span class="hljs-meta"><!DOCTYPE html></span></div><div class="codeLine"><span class="codeTag"><<span class="codeName">html</span> <span class="hljs-attr">lang</span>=<span class="codeAttrValue">"en"</span>></span></div><div class="codeLine"><span class="codeTag"><<span class="codeName">head</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">charset</span>=<span class="codeAttrValue">"UTF-8"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">name</span>=<span class="codeAttrValue">"viewport"</span> <span class="hljs-attr">content</span>=<span class="codeAttrValue">"width=device-width, initial-scale=1.0"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">name</span>=<span class="codeAttrValue">"keywords"</span> <span class="hljs-attr">content</span>=<span class="codeAttrValue">"小甲鱼,Web开发,HTML5,CSS3,Web编程教学"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">name</span>=<span class="codeAttrValue">"description"</span> <span class="hljs-attr">content</span>=<span class="codeAttrValue">"《零基础入门学习Web开发》课后作业"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">meta</span> <span class="hljs-attr">name</span>=<span class="codeAttrValue">"author"</span> <span class="hljs-attr">content</span>=<span class="codeAttrValue">"鱼C工作室"</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">title</span>></span>课后作业<span class="codeTag"></<span class="codeName">title</span>></span></div><div class="codeLine"> <span class="codeTag"></<span class="codeName">head</span>></span></div><div class="codeLine"><span class="codeTag"><<span class="codeName">body</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">p</span>></span>你最喜欢吃的水果是:<span class="codeTag"><<span class="codeName">span</span> <span class="hljs-attr">id</span>=<span class="codeAttrValue">"fruit"</span>></span> <span class="codeTag"></<span class="codeName">span</span>></span><span class="codeTag"></<span class="codeName">p</span>></span></div><div class="codeLine"> <span class="codeTag"><<span class="codeName">script</span>></span><span class="javascript"></span></div><div class="codeLine"><span class="javascript"> <span class="hljs-keyword">var</span> user_input = prompt(<span class="codeAttrValue">"你最喜欢吃的水果是:"</span>);</span></div><div class="codeLine"><span class="javascript"> <span class="hljs-built_in">document</span>.getElementById(<span class="codeAttrValue">"fruit"</span>).innerHTML = user_input;</span></div><div class="codeLine"><span class="javascript"></span> <span class="codeTag"></<span class="codeName">script</span>></span></div><div class="codeLine"><span class="codeTag"></<span class="codeName">body</span>></span></div><div class="codeLine"><span class="codeTag"></<span class="codeName">html</span>></span></div></code>
</pre>
</div>
</body>
</html>
你打字拼错了,是class,不是clsaa,,
其他的,,没什么区别叭,,
-------------------------------------------
>是实体字符,防止和保留字发生冲突。 1、显示没有问题,“xxx.txt” 转换成"xxx.html",并不会导致“显示”不同
2、不同是因为操作系统,浏览器渲染不同,从图1来看,没问题哈
页:
[1]