What can a JavaScript do?
JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages
JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("<h1>" + name + "</h1>") can write a variable text into an HTML page
JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element
JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element
JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing
JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser
JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer
Source link: http://www.w3schools.com/js/default.asp
相关文档:
1 一起困惑始于变量的作用域
请先看下面的代码:
示例1:
var message = " this is a very simple function ";
function simpleFunc(){
alert(message);
}
背后的道理大家都懂(如果不懂的可以先别往 ......
对象初始化方式(也叫json对象创建方式)
<script type="text/javascript">
var User = {
name:"centerqi",
age:25,
toString:function()
  ......
首先设置IE, 依次选择 工具-> Internet 选项-> 高级, 找到 浏览 下的两个禁用脚本调试复选框, 将其取消选择(IE默认将这两项选中, 不能进行脚本调试),
1. 调试JS脚本文件(*.js文件)
直接在JS文件中F9设置断点, F5运行调试即可.
2. 调试页面文件中脚本(*.aspx中JS脚本)
......