日期:2014-05-16  浏览次数:20357 次

《悟透JavaScript》之 甘露模型二
即可,因为 -M 参数表示制作 JAR 包的时候不添加 MANIFEST 清单,那么只需要在指定目标 JAR 文件的地方将 .jar 扩展名改为 .zip 扩展名,创建的就是一个不折不扣的 ZIP 文件了,如将上一节的第 3) 个例子略作改动:

jar cvfM test.zip test
re: drag 汪杰 2009-01-19 13:28
http://img1.qq.com/pinglun/pics/7689/7689824.gif
http://img1.qq.com/pinglun/pics/7689/7689827.gif
re: jq之拖动(by asfman) 汪杰 2008-11-02 23:57
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<style type="text/css">
#openwin{width: 300px; font-size: 12px; border: 1px solid rgb(112, 156, 210);}
.hd{background: #709cd2; padding: 5px 2px; color: #fff; border: 1px solid #fff;}
h2{ margin: 0; padding: 0; font-size: 14px;}
.closewin{float: right; width: 18px; background: url(dialogclose.gif) left center; height: 17px;}
p{margin: 0; padding: 5px 6px; text-indent: 2em;}
</style>
<script type="text/javascript">
<!--
$.fn.extend({
drag: function(parent, limit, sFunc, mFunc, eFunc){//limit range, start handler, moving handler, end handler
return this.each(function(){
var _this = parent ? this.parentNode : this;
if($.browser.msie) {
this.onselectstart = function(){return false};
if($(_this).css("backgroundColor") == "transparent")_this.style.background = "#fff";
}
if($.browser.mozilla) this.style.MozUserSelect = 'none';
this.style.cursor = "move";
$(this).mousedown(function(e){
sFunc && sFunc.call(_this);
var offset = $(_this).offset();
var screenX = e.screenX, screenY = e.screenY, w = _this.offsetWidth, h = _this.offsetHeight;
$(document).mousemove(function(e2){
if($.browser.msie && e.which != 1) return ($(document).unbind(), eFunc.call(_this));
var curLeft = offset.left + e2.screenX - screenX, curTop = offset.top + e2.screenY - screenY;
if(!limit) limit = {minX: -20000, maxX: 20000, minY: -20000, maxY : 20000};
curLeft = curLeft < limit.minX ? limit.minX : ((curLeft + w) > limit.maxX ? (limit.maxX - w) : curLeft);
curTop = curTop < limit.minY ? limit.minY : ((curTop + h) > limit.maxY ? (limit.maxY - h) : curTop);
$(_this).css({position: "absolute", left: curLeft, top: curTop});
if($.browser.msie && _this.tagName == "IMG") e2.preventDefault();
mFunc && mFunc.call(_this);
});
$(document).mouseup(function(){
$(document).unbind();
eFunc && eFunc.call(_this);
});
if(this.tagName == "IMG") e.preventDefault();
});
});
}
});
$(function(){
$(".hd").drag(true);
});
//-->
</script>
</head>
<body>

<div id="openwin">
<div class="hd">
<div class="closewin"></div>
<h2>窗口名字</h2>
</div>
<div id="bd">
<p>福建炼厂PP装置现产拉丝T30S,今日挂牌价普降1500元/吨。最新拉丝T30S挂牌价7500元/吨,膜料T36F挂牌价7500元/吨。厂家销售正常。</p>
</div>
</div>
<img align="absmiddle" src="dialogclose.gif" />
</body>
</html>
re: insertSmilies 汪杰 2008-10-21 21:38
<button onclick="AddText(123)">add</button>
<textarea id="test" rows="10" cols="100"></textarea>
<script type="text/javascript">
<!--
function AddText(txt) {
obj = document.getElementById("test");
selection = document.selection;
obj.focus();
if (typeof obj.selectionStart != "undefined") {
var opn = obj.selectionStart + 0;
obj.value = obj.value.substr(0, obj.selectionStart) + txt + obj.value.substr(obj.selecti