Javascript 数组学习一则
1. 应用 Array.prototype.join实现字符合并
方法1.
String.prototype.times = function(n) {
return Array.prototype.join.call({length:n+1}, this);
};
"js".times(5) // => "jsjsjsjsjs"
方法2.
var ArrayTest=new Array("HE","LL","O");
var hello = Array.prototype.join.call(ArrayTest, '|');
alert(hello); // => "HE|LL|O");
2.字符串分割成数组
var _param = "HE||LL||O";
var _paramArray = _param.split("|");
alert(_paramArray.length)
相关文档:
//获取当前文件全路径
<script language="javascript">
alert(window.location.href);
alert(window.location);
alert(location.href);
alert(parent.location.href);
alert(top.location.href);
alert(document.location.href);
alert(document.URL);
</scri ......
一、功能实现核心:FileSystemObject 对象
要在javascript中实现文件操作功能,主要就是依靠FileSystemobject对象。
二、FileSystemObject编程
使用FileSystemObject 对象进行编程很简单,一般要经过如下的步骤: 创建FileSystemObject对象、应用相关方法、访问对象相关属性 。
(一)创建FileSy ......
网页可见区域宽:document.body.clientWidth;
网页可见区域高:document.body.clientHeight;
网页可见区域高:document.body.offsetWidth (包括边线的宽);
网页可见区域高:document.body.offsetHeight (包括边线的宽);
网页正文全文宽:document.body.scrollWidth;
网页正文全文高:document.body.scrollHeight;
......
引言
JavaScript不是按面向对象的思想设计的程序语言,所以它不具备像现有的面向对象的语言那样的功能,但是面向对象的思想是如此的深入人心,以至于JavaScript也削尖了脑袋“面向对象”。果真,通过一些特殊的处理,JavaScript也具有了基本的面向对象的功能。
......