答案:注:我对原文进行了编辑,对一些词汇标注颜色,方便阅读。本来准备翻译,但是觉得文章简单易懂,而且原文写得很好,所以就不献丑了。希望对JavaScript初学者能有所帮助。你可以跟着作者一起做那些示例代码,等读完文章的时候,你就可以掌握JavaScript的基本操作了,你会发现其实这一切很容易。
Contents
Embedding and including
write and writeln
Document object
Message box
Function
Event handler
Form
Link
Date
Window
FrameEmbedding and including
Let's first see a 易做图 example:
< html >
< head >
< title > This is a JavaScript example </ title >
< script language ="JavaScript" >
<!--
document.write( " Hello World! " );
// -->
</ script >
</ head >
< body > Hi, man! </ body >
</ html >Usually, JavaScript code starts with the tag <Script language="JavaScript"> and ends with the tag </script>. The code placed between <head> and </head>. Sometimes, people embed the code in the <body> tags:
< html >
< head ></ head >
< body >
< script >
.. // The code embedded in the <body> tags.
</ script >
</ body >
</ html >Why do we place JavaScript code inside comment fields
<!--
and//-->
?
It's for ensuring that the Script is not displayed by old browsers that do not support JavaScript. This is optional, but considered good practice. The LANGUAGE attribute also is optional, but recommended. You may specify a particular version of JavaScript:< script language ="JavaScript1.2" >You can use another attribute SRC to include an external file containing JavaScript code:
如何用javascript判断录入的日期是否合法
下一个:对象的类型:本地对象(1)
- 更多JS疑问解答:
- 几个验证11位手机号码格式的js代码
- js把图片转换成 base64代码
- js把base代码转换成图片
- JS 将 base64编码的图片转化为图片文件
- js中的定时器
- js如何获得FCKeditor控件的值
- 用js限制投票的cookie .目前设置的为:<input type="" class="" onclick="'window.location...
- JS验证,这块“牛皮”反复修改都不能实现
- 在JS中使用DOM模型
- 如何用JS 获取本地文件夹的文件列表
- js中new 了两个Object数组。怎么样将数组内容合并,重复的内容?
- 求实现自动生成图片缩略图的JS代码
- JS脚本网页问题
- js,代码中"object"和"Object"区别?
- js+flash实现网页图片切换效果,出现边框,单击激活此控件。