java 显示图片预览DIV

//显示图片预览DIV
function showpicture(name) {

	var pathvalue = "";
	pathvalue = document.getElementById(name).value;
	if(pathvalue=="")
	{
	 alert("没有可以预览的图片!");
	}
	else
	{
	 var len=pathvalue.length;
	 var endstring=pathvalue.substring(len-1,len);
	 if(endstring==",")//用户判断,如果上传的图片串最后一个字符带有','的话,先去掉',',在进行处理;
	 {
	    pathvalue=pathvalue.substring(0,len-1);
	 }
	var divappends = "";
	var arrypaht = pathvalue.split(",");
	for (var i = 0; i < arrypaht.length; i++) {
		divappends += "<li><a href='"+ arrypaht[i].toString() +"' target='_blank'><img src='" + arrypaht[i].toString() + "' οnlοad='if(this.width>350){this.width = 350;}' border='0'/></a></li>";
	}
	if (divappends != "") {
		document.getElementById("displaypicture").style.display = "block";
	}
	document.getElementById("rollList").innerHTML = divappends;
	}
	scall();
}

function scall(){
 $("#displaypicture").css("top",document.documentElement.scrollTop+100);
}
window.οnscrοll=scall;
//关闭图片预览DIV
function closeshow() {
	document.getElementById("displaypicture").style.display = "none";
}

//图片显示效果JS开始
var $id = function (id) {
	return document.getElementById(id);
};
var scrollHori = {locked:0, vector:0, start:function (thiso) {
	if (scrollHori.locked == 0) {
		if (thiso.id == "rollLeft" && $id("rollBox").scrollLeft != 0) {
			scrollHori.vector = -20;
			scrollHori.scroll();
		}
		if (thiso.id == "rollRight" && $id("rollBox").scrollLeft != ($id("rollList").offsetWidth - $id("rollBox").offsetWidth)) {
			scrollHori.vector =20;
			scrollHori.scroll();
		}
	}
}, scroll:function () {
	var step = 0;
	var size = $id("rollList").offsetWidth / $id("rollList").getElementsByTagName("li").length;
	play = setInterval(function () {
		if (size > step) {
			$id("rollBox").scrollLeft += scrollHori.vector;
			step += Math.abs(scrollHori.vector);
			scrollHori.locked = 1;
		} else {
			scrollHori.stop();
		}
	}, 20);
}, stop:function () {
	if (window.play) {
		clearInterval(window.play);
		scrollHori.locked = 0;
	}
}};
//图片显示效果JS结束


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值