📄 1.htm
字号:
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">嵌入方式不一样<br>
在HTML文档中,两种编程语言的标识不同,JavaScript使用<Script>...</Script>来标识,而Java使用<applet>...</applet>来标识。</font></span>
<li>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">静态联编和动态联编<br>
Java采用静态联编,即Java的对象引用必须在编译时的进行,以使编译器能够实现强类型检查。<br>
JavaScript采用动态联编,即JavaScript的对象引用在运行时进行检查,如不经编译则就无法实现对象引用的检查。</font></span></li>
</ol>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"> </font></span></p>
<font lang="ZH-CN"><b>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">三、JavaScript程序运行环境</font></span>
<dir>
</b></font>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">1.Java运行环境</font></span>
<dir>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">软件环境:</font></span></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> Windows
95/98或Windows NT。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> Netscape
Navigator x.0或Internet Explorer x.0。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> 用于编辑HTML文档的字符编辑器(WS、WPS、Notepad、WordPad等)或HTML文档编辑器。</span></font></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"> </font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">硬件配置:</font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">首先必须具备运行Windows
95/98或Windows NT的基本硬件配置环境。推荐:</font></span></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12">
</span></font></font><font size="3"><span style="FONT-SIZE: 9pt">基本内存32M。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12">
</span></font></font><font size="3"><span style="FONT-SIZE: 9pt">CRT只少需要256颜色,分辨率在640X480以上。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12">
</span></font></font><font size="3"><span style="FONT-SIZE: 9pt">CPU只少233以上。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12">
</span></font></font><font size="3"><span style="FONT-SIZE: 9pt">鼠标和其它外部设置(根据需要选用)。</span></font></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"> </font></span></p>
</dir>
</dir>
<font lang="ZH-CN"><b>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">四、编写第一个JavaScript程序</font></span>
<dir>
</b></font>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">下面我们通过一个例子,编写第一个JavaScript程序。通过它可说明JavaScript的脚本是怎样被嵌入到HTML文档中的。</font></span></p>
</dir>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">test1.html文档:</font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"><html></font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"><head></font></span></p>
<font color="#0000ff" lang="ZH-CN">
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"><Script
Language ="JavaScript"></font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">//
JavaScript Appears here.</font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">alert("这是第一个JavaScript例子!");</font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">alert("欢迎你进入JavaScript世界!");</font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">alert("今后我们将共同学习JavaScript知识!");</font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"></Script></font></span></p>
</font>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"></Head></font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"></Html></font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"> 在<i>Internet
Explore5.0中运行</i>行后的结果见图1-1所示。</font></span></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"><img src="Image25.gif" width="367" height="271"></font></span>
<dir>
<dir>
<dir>
<dir>
</font>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">图1-1
程序运行的结果</font></span></p>
</dir>
</dir>
</dir>
</dir>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"> </font></span></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3">说明:</font></span></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> test.html是HTML文档,其标识格式为标准的HTML格式;</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> 如同HTML标识语言一样,
JavaScript程序代码是一些可用字处理软件浏览的文本,它在描述页面的HTML相关区域出现。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> JavaScript代码由
<Script Language ="JavaScript">...</Script>说明。在标识<Script
Language ="JavaScript">...</Script>之间就可加入JavaScript脚本。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> alert()是JavaScript的窗口对象方法,其功能是弹出一个具有OK对话框并显示()中的字符串。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> 通过<!--
...//-->标识说明:若不认识JavaScript代码的浏览器,则所有在其中的标识均被忽略;若认识,则执行其结果。使用注释这是一个好的编程习惯,它使其他人可以读懂你的语言。</span></font></p>
<font lang="ZH-CN">
<p style="line-height: 150%"><font size="3"><span style="FONT-SIZE: 9pt"><img src="Bullet3.gif" width="12" height="12"></span></font></font><font size="3"><span style="FONT-SIZE: 9pt"> JavaScript
以 </Script> 标签结束。</span></font></p>
<p style="line-height: 150%"><span style="FONT-SIZE: 9pt"><font size="3"> 从上面的实例分析中我们可以看出,编写一个JavaScript程序确实非常容易的。</font></span></p>
<p> </td>
</tr>
</table>
<!--mstheme--></font>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -