摘要: 如果我们页面看到的图片都是缩略图,那就需要做个图片点击放大效果,那么怎样获取图片的原始宽高呢?方法如下: //获取图片原始宽度 function getNaturalWidthAndHeight(img) { var image = new Image(); image.src = img.src; 阅读全文
posted @ 2016-05-17 12:12 haishu 阅读(722) 评论(0) 推荐(0) 编辑
摘要: prototype是向对象中添加属性和方法,返回对象类型原型的引用,例如对js中日期函数Date进行扩展: Date.prototype.Format = function (fmt) { var o = { "M+": this.getMonth() + 1, //月份 "d+": this.ge 阅读全文
posted @ 2016-05-17 12:06 haishu 阅读(630) 评论(0) 推荐(0) 编辑
摘要: 在web端定义js方法去接收客户端传递过来的参数,具体就是获取地址中?后的数据,各个参数用&分割,存储于数组中,获取。 具体如下: //定义获取地址中参数的方法 function GetRequest() { var url = location.search; var theRequest = n 阅读全文
posted @ 2016-05-17 11:56 haishu 阅读(484) 评论(0) 推荐(0) 编辑
摘要: 给div加浮动: position:fixed; 固定宽度,高度,距离头部,左部为0:width: 99%; height: 80px; top:0; left: 0; 阅读全文
posted @ 2016-05-17 11:51 haishu 阅读(3951) 评论(0) 推荐(0) 编辑