js学习笔记2
来源:互联网 发布:什么是社交网络 编辑:程序博客网 时间:2024/04/29 23:17
Task 32
Calling Your JavaScript Code after the Page Has Loaded
页面加载完成后调用JavaScript Code
<head>
<script language=”JavaScript”>
<!--
function hello() {
window.alert(“Hello”);
}
// -->
</script>
</head>
<body onLoad=”hello();”>
The page’s content.
</body>
Task 43
Check If Java Is Enabled with JavaScript
检查页面是否可以运行Java
Sometimes it is useful to know whether or not Java is enabled and to use that
information in composing your pages. For instance, based on that informa-
tion, you could dynamically adjust the content of your page to include or not
include Java-based content.
Luckily, JavaScript provides a simple mechanism for determining this: the navi-
gator.javaEnabled method. This method returns true if Java is enabled in
the browser and false otherwise.
Task 44
Accessing the document Object
获取页面上的document对象
The document object is an extremely powerful and important object in
JavaScript that allows you to output data to the browser’s document stream,
as well as to access elements in the current document rendered in the browser.
Using this object, you can generate dynamic output in your document, and you
can manipulate the state of the document once rendered. The document object
provides a lot of information, methods, and access to objects reflecting the cur-
rent document, including the following:
a. Arrays containing anchors, applets, embedded objects, forms, layers,
links, and plug-ins from the current document.
b. Properties providing information about the current page, including
link colors, page background color, associated cookies, the domain of
the page, the modification date, the referring document, the title, and
the URL of the current document.
c. Methods to allow outputting text to the document stream, events to
handle events, and an event to return text currently selected in the
document.
Task 49
Controlling the Format of Date Output
控制日期输出方式
a. toGMTString: Returns the time as a string converted to Greenwich
Mean Time. The results look like this:
Thu, 17 Apr 2003 17:47:44 UTC
b. toLocaleString: Returns the time as a string using the date for-
matting conventions of the current locale. The results look like this
in Canada:
April 17, 2003 10:47:44 AM
c. toUTCString: Returns the time as a string converted to Universal
Time. The results look like this in North America:
Thu, 17 Apr 2003 17:47:44 UTC
相关函数:
getDate: Returns the current day of the month as a number
getDay : Returns the current day of the week as a number between 0(Sunday) and 6 (Saturday)
getFullYear: Returns the four-digit year
getHours: Returns the hour from the current time as a number between 0 and 23
getMinutes: Returns the minutes from the current time as a number between 0 and 59
getMonth: Returns the current month as a number between 0(January) and 11 (December)
- JS学习笔记2
- js学习笔记2
- js学习笔记2
- JS学习笔记2
- JS学习笔记2
- js学习笔记2
- js学习笔记2
- JS 学习笔记2
- JS学习笔记2
- js学习笔记2
- require.js学习笔记2
- html(JS)学习笔记2
- vue.js学习笔记2
- vue.js学习笔记-2
- js视频学习笔记2
- JS-SIG(CAS)学习笔记2
- 常用JS总结2-学习笔记
- Node.js学习笔记2【核心模块】
- ADS1.2连接器使用手册
- a wonderful beginning of the new year
- 在Excel与Flex之间粘贴数据
- _tcscmp()
- CRC源码大全
- js学习笔记2
- Iterator类的用法
- [摘自互联网]MSChart
- display table 标签用法 对分页和导出excel有帮助
- 易货华殷
- 文件上传和下载常用用例
- 邢红瑞的blog--一点一滴培养你的领导气质(转)
- SQL Server 2000 Java开发中当前日期的处理
- 数据结构与算法(C++)之一——顺序表(SeqList)