⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attach.js

📁 PHPShops多用户商城系统(简称PHPShops)是基于电子商务的一套平台交易系统
💻 JS
字号:

var att = {

	modify : function(aid) {
		var s = $('attach_'+aid);
		var o = att.create(aid);
		s.parentNode.insertBefore(o,s);
		o.select();
		s.style.display = 'none';
		att.change(aid,2);
	},

	create : function(aid) {
		var o		= document.createElement('input');
		o.type		= 'file';
		o.className	= 'input file';
		o.size		= 20;
		o.maxLength	= 100;
		o.name		= 'replace_'+aid;
		o.id		= 'replace_'+aid;
		o.onmouseover = function(){att.show(aid)};
		return o;
	},
	
	cancle : function(aid) {
		var o = $('replace_'+aid);
		var s = $('attach_'+aid);
		o.parentNode.removeChild(o);
		s.style.display = '';
		att.change(aid,1);
	},

	change : function(aid,type) {
		var s = $('md_'+aid);
		if (type==2) {
			s.innerHTML = '取消';
			s.onclick = function(){att.cancle(aid)};
		} else {
			s.innerHTML = '更新';
			s.onclick = function(){att.modify(aid)};
		}
	},
	
	show : function(aid) {
		if (IsElement('replace_'+aid)) {
			var path = $('replace_'+aid).value;
			var attach_ext = path.substr(path.lastIndexOf('.') + 1, path.length).toLowerCase();
			if(!is_ie || !in_array(attach_ext,['jpg','gif','png','bmp','jpeg']))
				return;
			$('viewimg').innerHTML = getimage(path,320);
			read.open('viewimg','att_'+aid,3);
		} else {
			var path = $('atturl_'+aid).innerHTML;
			$('viewimg').innerHTML = getimage(path,320);
			read.open('viewimg','att_'+aid,3);
		}
	},
	
	add : function(aid) {
		editor.focusEditor();
		editor.insertText(' [attachment='+aid+'] ');
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -