常用js脚本
来源:互联网 发布:js设置全局变量 编辑:程序博客网 时间:2024/05/16 00:35
/*随机数字(0~limit之间的随机数包含0和不包含limit)*/
function randomNumber(limit){
return Math.floor(Math.random()*limit);
}
/*冒泡排序*/
function bubbleSort(theArray)
{
var i, j;
for (i = theArray.length - 1; i >= 0; i--)
{
for (j = 0; j <= i; j++)
{
if (theArray[j+1] < theArray[j])
{
var temp = theArray[j];
theArray[j] = theArray[j+1];
theArray[j+1] = temp;
}
}
}
return theArray;
}
/*字符替换*/
function replaceCharacters(conversionString,inChar,outChar)
{
var convertedString = conversionString.split(inChar);
convertedString = convertedString.join(outChar);
return convertedString;
}
/*信息窗口*/
var msgWindow = null;
function messageWindow(title, msg)
{
var width="300", height="125";
var left = (screen.width/2) - width/2;
var top = (screen.height/2) - height/2;
var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
if(msgWindow==null){
msgWindow = window.open("","msgWindow", styleStr);
var head = '<head><title>'+title+'</title></head>';
var body = '<center>'+msg+'<br><p><form><input type="button" value=" Done " onClick="self.close()"></form>';
msgWindow.document.write(head + body);
}
}
/*弹出窗口*/
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
if(popUpWin)
{
if(!popUpWin.closed) popUpWin.close();
}
popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
/*确认*/
confirm(messageStr);
function randomNumber(limit){
return Math.floor(Math.random()*limit);
}
/*冒泡排序*/
function bubbleSort(theArray)
{
var i, j;
for (i = theArray.length - 1; i >= 0; i--)
{
for (j = 0; j <= i; j++)
{
if (theArray[j+1] < theArray[j])
{
var temp = theArray[j];
theArray[j] = theArray[j+1];
theArray[j+1] = temp;
}
}
}
return theArray;
}
/*字符替换*/
function replaceCharacters(conversionString,inChar,outChar)
{
var convertedString = conversionString.split(inChar);
convertedString = convertedString.join(outChar);
return convertedString;
}
/*信息窗口*/
var msgWindow = null;
function messageWindow(title, msg)
{
var width="300", height="125";
var left = (screen.width/2) - width/2;
var top = (screen.height/2) - height/2;
var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
if(msgWindow==null){
msgWindow = window.open("","msgWindow", styleStr);
var head = '<head><title>'+title+'</title></head>';
var body = '<center>'+msg+'<br><p><form><input type="button" value=" Done " onClick="self.close()"></form>';
msgWindow.document.write(head + body);
}
}
/*弹出窗口*/
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
if(popUpWin)
{
if(!popUpWin.closed) popUpWin.close();
}
popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
/*确认*/
confirm(messageStr);
- js常用脚本
- js 常用脚本
- js脚本常用代码
- JS 常用脚本
- 一些常用JS脚本
- 常用js脚本
- Js常用脚本小结
- 常用js脚本
- js常用脚本
- JS常用脚本
- 注册常用js脚本
- 常用的js脚本
- 常用js脚本验证
- 常用JS脚本
- js- 常用脚本代码
- 一些常用的js脚本
- 一些常用的JS脚本
- 常用的脚本验证 js
- RIA
- ACE简介
- newxy新坐标的事务管理
- 用 bash 脚本统计词频
- JDK1.5中LinkedBlockingQueue的bug
- 常用js脚本
- 使用 iptables
- 加壳脱壳(转)
- 一个龌鹾的人
- 符号数的识别
- 使用Visual Studio 2005创建以及移植智能设备自定义控件
- 用才应通权达变扬长避短
- 物理盘,逻辑盘对应?
- ORA-01704: 文字字符串过长!