鱼C论坛

 找回密码
 立即注册
查看: 2055|回复: 4

[已解决]新手 第9 课后题 请教

[复制链接]
发表于 2019-1-31 23:47:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 williamso 于 2019-2-1 23:19 编辑

保存为  .txt 文本   。但 为什么 保存为  .html 文件后 显示不同了  --- 》 图1   
<!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">&lt;!DOCTYPE html&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;<span class="codeName">html</span> <span class="hljs-attr">lang</span>=<span class="codeAttrValue">"en"</span>&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;<span class="codeName">head</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<span class="codeName">meta</span> <span class="hljs-attr">charset</span>=<span class="codeAttrValue">"UTF-8"</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<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>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<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>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<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>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<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>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<span class="codeName">title</span>&gt;</span>课后作业<span class="codeTag">&lt;/<span class="codeName">title</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;/<span class="codeName">head</span>&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;<span class="codeName">body</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<span class="codeName">p</span>&gt;</span>你最喜欢吃的水果是:<span class="codeTag">&lt;<span class="codeName">span</span> <span class="hljs-attr">id</span>=<span class="codeAttrValue">"fruit"</span>&gt;</span> <span class="codeTag">&lt;/<span class="codeName">span</span>&gt;</span><span class="codeTag">&lt;/<span class="codeName">p</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<span class="codeName">script</span>&gt;</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">&lt;/<span class="codeName">script</span>&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;/<span class="codeName">body</span>&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;/<span class="codeName">html</span>&gt;</span></div></code>
        </pre>
    </div>
</body>
</html>
最佳答案
2019-2-3 20:16:33
1、显示没有问题,“xxx.txt” 转换成"xxx.html",并不会导致“显示”不同

2、不同是因为操作系统,浏览器渲染不同,从图1来看,没问题哈
图1.jpg
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2019-2-3 09:00:39 | 显示全部楼层
哪里不同了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-2-3 10:57:32 | 显示全部楼层
本帖最后由 williamso 于 2019-2-3 11:03 编辑


开始 保存 txt ,转换 html 格式  ( 是不是 格式的问题 TXT 转换 HTML )
***************************************第 13 行 / 第 14行   保存 html 后 变成 短短的的这几行 图1

       < pre clsaa="prettyprint hljs-dark"><code class="hljs xml"><div class="codeLine"><span class="hljs-meta">&lt,!DOCTYPE html&gt</span></div><div class="codeLine"><span class="codeTag">&lt...................
     </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">&lt;!DOCTYPE html&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;<span class="codeName">html</span> <span class="hljs-attr">lang</span>=<span class="codeAttrValue">"en"</span>&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;<span class="codeName">head</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<span class="codeName">meta</span> <span class="hljs-attr">charset</span>=<span class="codeAttrValue">"UTF-8"</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<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>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<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>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<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>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<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>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<span class="codeName">title</span>&gt;</span>课后作业<span class="codeTag">&lt;/<span class="codeName">title</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;/<span class="codeName">head</span>&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;<span class="codeName">body</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<span class="codeName">p</span>&gt;</span>你最喜欢吃的水果是:<span class="codeTag">&lt;<span class="codeName">span</span> <span class="hljs-attr">id</span>=<span class="codeAttrValue">"fruit"</span>&gt;</span> <span class="codeTag">&lt;/<span class="codeName">span</span>&gt;</span><span class="codeTag">&lt;/<span class="codeName">p</span>&gt;</span></div><div class="codeLine">    <span class="codeTag">&lt;<span class="codeName">script</span>&gt;</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">&lt;/<span class="codeName">script</span>&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;/<span class="codeName">body</span>&gt;</span></div><div class="codeLine"><span class="codeTag">&lt;/<span class="codeName">html</span>&gt;</span></div></code>
        </pre>
    </div>
</body>
</html>
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2019-2-3 12:02:11 | 显示全部楼层
你打字拼错了,是class,不是clsaa,,
其他的,,没什么区别叭,,
-------------------------------------------
&gt;是实体字符,防止和保留字发生冲突。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2019-2-3 20:16:33 | 显示全部楼层    本楼为最佳答案   
1、显示没有问题,“xxx.txt” 转换成"xxx.html",并不会导致“显示”不同

2、不同是因为操作系统,浏览器渲染不同,从图1来看,没问题哈
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-22 14:23

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表