javascript变量作用域
变量的作用域指的是变量的可见性,而生命周期则(存活期)则是从另一个角度考察变量。 js中变量的作用域分为全局变量和局部变量,函数内定义的称为局部变量,函数外的称为全局变量。(“函数外的称为全局变量”是相对的,另此处讨论的前提是用var显式声明的变量,函数内不用var定义的变量默认是全局变量,当然忽略var声明变量是不赞成的)。
相关文档:
<html>
<head>
<mce:script type = "text/javascript"><!--
function changetext()
{
var x = document.getElementById("list");
for (var i = 0;i < x.length;i++ )
{
if (x.options[i].selected)
{
document.getElemen ......
//1.类
function Test(id)
{
this.id=id;
this.method=function()
{
//代码
};
}
......
var sDate = new Date(Date.UTC(arys[0], arys[1] - 1, arys[2]));
var eDate = new Date(Date.UTC(arys1[0], arys1[1] - 1, arys1[2]));
......
注册很长时间号了,刚开通博客,拿出一个自己写的javascript右键菜单,兼容IE,firefox浏览器
这是css代码
body{
font-size:12px;
}
.contextMenu{
filter:alpha(opacity=80);
opacity:0.8;
border:1px #0033FF solid;
background-color:#0099CC;
cursor:pointer;
width:120px;
position:absolute;
top: ......