立诚勿怠,格物致知
It's all about connecting the dots

JavaScript 第12页

JavaScript和Cookies

cookie简介 当网页服务器和你的浏览器“初次见面”时,网页服务器会提供一段独一无二的“信息”给你的服务器,二者此后再“见面”时可以彼此共享这些“信息”。远程服务器会保存这些“信息”,你的浏览器也会把这些“信息”以纯文本的形式保存在你的电...

阅读(4322)去评论赞(0)

JavaScript中的事件

当用户的某个行为影响到整个浏览器窗口时,窗口事件就发生了。最常见的窗口事件是通过简单地打开一个网页来加载窗口。关闭、移动窗口或者将窗口置于其他窗口的后面等事件也能触发相应的event hanlder。

阅读(4148)去评论赞(0)

正则表达式与JavaScript

A regular expression (often abbreviated as RegExp or called by its synonym grep) is a pattern, written using special symbols, which describes one or more text strings. You use regular expressions to match patterns of text, so that your script can easily recognize and manipulate text. Like an arithmetic expression, you create a regular expression by using operators, in this case operators that work on text, rather than numbers. There are many regular expression operators. By learning and using these operators, you'll be able to save yourself a huge amount of effort whenever you need to detect and manipulate text strings.

阅读(2318)去评论赞(0)

Uncaught TypeError: Cannot read property 'children' of null

P.S: You should not use "children". It would be better to use "childNodes" instead of the "children". "childNodes" is supported by all major browsers including IE, while "children" (invented by IE) is not well supported by major browsers other than IE. The former conforms to the standard while the later is not.

阅读(2084)去评论赞(1)

parentNode, childNodes, children and parentElement in JavaScript

Note that error may be returned if you place the above code snippet between the opening <head> tag and the closing <head>. This is because that all JavaScript-supported browsers will run these JavaScript code before the DOM is entirely interpreted. If you are using Firefox, the error returned is like: document.getElementById("child") has no properties, while the error returned by IE is like: Object Required.

阅读(1677)去评论赞(0)

evt and window.event in JavaScript

You may want to ask what "thisSquare" here means. A good question! You know, typically, a BINGO game is played on a 5 rows * 5 columns layout (therefore there are 25 cells in total). The above code is aimed to fetch the information that which cell is clicked by the mouse (so you now know "thisSquare" refers to the currently clicked cell). However, the meaning of "thisSquare" is not my concern. I paid much attention to the contents after the equality sign, i.e. "evt.target" and "window.event.srcElement".

阅读(1873)去评论赞(0)

Simplest Image Rollovers Effect Created by JavaScript

The above small code snippet is very simple, but with some problems and drawbacks:

  • Because the second image is downloaded from the server at the time the user rools over the first image, there can be a perceptible delay before the second image replaces the first one, especially for people browsing your site with a slower connection.
  • Using this method causes an error message in ancient browsers, such as Netscape 2.0 or earlier, Internet Explorer 3.0 or earlier, or the America Online 2.7 browser. Since there are so few of these vintage browsers still in use, it's not much of a problem these days.

阅读(1937)去评论赞(0)

Operators in JavaScript

Operators are the symbols used to work with variables. Operators in JavaScript, as in PHP, can involve mathematics, changes to strings, and comparison and logcal operations (and, or, etc.).

阅读(2055)去评论赞(0)

登录

找回密码

注册