function ok()
{
var aa=("aa;bb;cc;dd;ee;gg;hh").split(";");//看做一个表
var list=new Array(aa.length);//定义集合
for(var i=0;i<aa.length;i++)//循环表的集合
{
list[i]=aa[i];
}
alert(list);
}
function showdiv(){
//得到页面的宽度
var screenWidth = window.screen.width;
var screenHeight = window.screen.height;
//得到document对象
var doc = top.document;
//创建一个新的div
var div = document.getElementById("div1");
if(div==null)
div = doc.createElement("DIV");
div.id = "div1"; //设置id
//下面设置层的显示位置,绝对定位
div.style.top = screenHeight/4+"px";
div.style.left = screenWidth/4+"px";
div.style.width=screenWidth/2+"px";
div.style.height=screenHeight/2+"px";
div.style.position = "absolute";
div.style.background="red";
//设置层显示出来
div.style.display ='';
//层中间的内容
div.innerHTML = '<img src=/"11.jpg/" width=100 height="100">';
//将层添加到当前页面
doc.body.appendChild(div);
}
function hiddiv(){
//工具id得到曾对象
var div = document.getElementById("div1");
if(div==null)
return ;
//隐藏层
div.style.display ='none';
//移出层
// document.body.removeChild(div);
}
<SCRIPT>
function do1(){
//通过opener来取得父窗口对象
opener.window.location.reload();
opener.window.do2();
}
</SCRIPT>
int pagecount =Page.Controls.Count;
for (int i = 0; i < pagecount; i++)
{
foreach (Control tc in Page.Controls[i].Controls)
{
if (tc is CheckBox)
{
if (((CheckBox)tc).Checked == true)
{
ss =ss+""+((CheckBox)tc).Text.ToString()+"//";
}
}
}
}
Response.Write(ss.Substring(0, ss.LastIndexOf('//')));
Response.Cache.SetNoServerCaching();
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(new DateTime(1900, 01, 01, 00, 00, 00, 00));
<script language="javascript" type="text/JavaScript">
function openFilter()
{
showx = event.screenX - event.offsetX - 4 - 10 ; // + deltaX;
showy = event.screenY - event.offsetY ; // + deltaY;
newWINwidth = 210 + 4 + 18;
var retval = window.showModalDialog("b.aspx", "", "dialogWidth:600px; dialogHeight:500px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; " );
if( retval != null )
{
//alert(retval);
document.form1.hFilter.value=retval;
document.form1.submit();
}
}
</script>
//第二个 页面写以下代码 把值返回到第一个页面中去 同时关闭了该窗体
function ReturnValue(rtnValue)
{
window.returnValue = rtnValue;
window.close();
}
Page.RegisterClientScriptBlock("", "<script >ReturnValue('" + strReturn + "');</script>");
//获取当前登录用户
pUserName = Request.ServerVariables["LOGON_USER"];
<script language="javascript" type="text/javascript">
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
</script>
<li><a href="javascript:window.parent.document.location.href='login.aspx'" target="_parent">注销(Log off)</a> </li>
<li><a href="javascript:window.external.AddFavorite('http://Localhost/ultimusclient/MasterPage.aspx','Ultimus BPM')" target="_parent">收藏(Favorite)</a></li>
var life = {};
for(life.age = 1; life.age <= 3; life.age++)
{
switch(life.age)
{
case 1: life.body = "卵细胞";
life.say = function(){alert(this.age+this.body)};
break;
case 2: life.tail = "尾巴";
life.gill = "腮";
life.body = "蝌蚪";
life.say = function(){alert(this.age+this.body+"-"+this.tail+","+this.gill)};
break;
case 3: delete life.tail;
delete life.gill;
life.legs = "四条腿";
life.lung = "肺";
life.body = "青蛙";
life.say = function(){alert(this.age+this.body+"-"+this.legs+","+this.lung)};
break;
};
life.say();
};
变量式:
var myfunc = function ()
{
alert("hello");
};
myfunc(); //第一次调用myfunc,输出hello
myfunc = function ()
{
alert("yeah");
};
myfunc(); //第二次调用myfunc,将输出yeah
定义式:
function myfunc ()
{
alert("hello");
};
myfunc(); //这里调用myfunc,输出yeah而不是hello
function myfunc ()
{
alert("yeah");
};
myfunc(); //这里调用myfunc,当然输出yeah
function Sing()
{
with(arguments.callee)
alert(author + ":" + poem);
};
Sing.author = "李白";
Sing.poem = "汉家秦地月,流影照明妃。一上玉关道,天涯去不归";
Sing();
Sing.author = "李战";
Sing.poem = "日出汉家天,月落阴山前。女儿琵琶怨,已唱三千年";
Sing();
var anObject = {}; //一个对象
anObject.aProperty = "Property of object"; //对象的一个属性
anObject.aMethod = function(){alert("Method of object")}; //对象的一个方法
//主要看下面:
alert(anObject["aProperty"]); //可以将对象当数组以属性名作为下标来访问属性
anObject["aMethod"](); //可以将对象当数组以方法名作为下标来调用方法
for( var s in anObject) //遍历对象的所有属性和方法进行迭代化处理
alert(s + " is a " + typeof(anObject[s]));
同样对于function类型的对象也是一样:
var aFunction = function() {}; //一个函数
aFunction.aProperty = "Property of function"; //函数的一个属性
aFunction.aMethod = function(){alert("Method of function")}; //函数的一个方法
//主要看下面:
alert(aFunction["aProperty"]); //可以将函数当数组以属性名作为下标来访问属性
aFunction["aMethod"](); //可以将函数当数组以方法名作为下标来调用方法
for( var s in aFunction) //遍历函数的所有属性和方法进行迭代化处理
alert(s + " is a " + typeof(aFunction[s]));
unction WhoAmI() //定义一个函数WhoAmI
{
alert("I'm " + this.name + " of " + typeof(this));
};
WhoAmI(); //此时是this当前这段代码的全局对象,在浏览器中就是window对象,其name属性为空字符串。输出:I'm of object
var BillGates = {name: "Bill Gates"};
BillGates.WhoAmI = WhoAmI; //将函数WhoAmI作为BillGates的方法。
BillGates.WhoAmI(); //此时的this是BillGates。输出:I'm Bill Gates of object
var SteveJobs = {name: "Steve Jobs"};
SteveJobs.WhoAmI = WhoAmI; //将函数WhoAmI作为SteveJobs的方法。
SteveJobs.WhoAmI(); //此时的this是SteveJobs。输出:I'm Steve Jobs of object
WhoAmI.call(BillGates); //直接将BillGates作为this,调用WhoAmI。输出:I'm Bill Gates of object
WhoAmI.call(SteveJobs); //直接将SteveJobs作为this,调用WhoAmI。输出:I'm Steve Jobs of object
BillGates.WhoAmI.call(SteveJobs); //将SteveJobs作为this,却调用BillGates的WhoAmI方法。输出:I'm Steve Jobs of object
SteveJobs.WhoAmI.call(BillGates); //将BillGates作为this,却调用SteveJobs的WhoAmI方法。输出:I'm Bill Gates of object
WhoAmI.WhoAmI = WhoAmI; //将WhoAmI函数设置为自身的方法。
WhoAmI.name = "WhoAmI";
WhoAmI.WhoAmI(); //此时的this是WhoAmI函数自己。输出:I'm WhoAmI of function
({name: "nobody", WhoAmI: WhoAmI}).WhoAmI(); //临时创建一个匿名对象并设置属性后调用WhoAmI方法。输出:I'm nobody of object
function person(name)
{
this.name=name;
};
person.prototype.company="c-store";
person.prototype.SayHello=function()
{
alert("hello, I'm "+this.name +" of "+this.company);
};
var Bill=new person("hujjj");
Bill.company="C-Store";
Bill.SayHello();
var xiaojiao=new person("Xiaojiao")
xiaojiao.company="RT-Mark";
xiaojiao.SayHello=function()
{
alert("Hi, "+this.name+ " like "+this.company+" jhaha");
}
xiaojiao.SayHello();