<span class="timeString">Fri, 31 Aug 2012 10:57:04 GMT</span>
$(".timeString").each(function () {var content = $(this).text();var d = new Date(content);if (!isNaN(d)) $(this).text(d.format("yyyy-mm-dd hh:MM tt"));});
void Application_BeginRequest(object sender, EventArgs e)
{
UW.WU.BlockHacker();
}
netstat -an
tcp 0.0.0.0:80 需沒有
tcp 192.168.0.203:80 需有
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList
會列出開機時會載入的 httpcfg set iplisten,若 ip 有設錯 iis 可能會出現 "指定的網路名稱格式不正確"
<!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>
<title></title>
<script type="text/javascript" src="/Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(window).bind("paste", function () {
if (event.clipboardData) {
var clipboardData, found;
found = false;
clipboardData = event.clipboardData;
Array.prototype.forEach.call(clipboardData.items, function (item, i) {
if (item.type.indexOf("image") !== -1) {
var blob = clipboardData.items[i].getAsFile();
var URL = window.URL || window.webkitURL;
var source = URL.createObjectURL(blob);
pastedImage = new Image();
pastedImage.src = source;
pastedImage.onload = function () {
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.width = pastedImage.width;
canvas.height = pastedImage.height;
ctx.drawImage(pastedImage, 0, 0);
var base64 = canvas.toDataURL();
base64 = base64.substring(base64.indexOf("iVBOR"));
$.ajax({
url: "/API/AddTaskImages.aspx",
async: false,
type: "POST",
data: ({
Image: base64
}),
dataType: "html",
success: function (msg) {
var oRes;
try {
oRes = eval(msg);
}
catch (err) {
alert("無法解析傳回資料 !");
alert(msg);
alert(err);
}
if (oRes.success) {
alert("Upload Success..");
//alert(oRes.msg);
$("#MyImageDataLoadDemo").attr("src", oRes.msg);
} else {
alert(oRes.msg);
}
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
})
};
return false;
}
});
}
});
});
</script>
</head>
<body>
<div id="hold">
<div id="imgHold"><img src="" id="MyImageDataLoadDemo"></div>
<div>Click on the area above and ctrl+p an image to paste</div>
</div>
</body>
</html>
Partial Class API_AddTaskImages
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
'DB.sysconfig.Path.TaskAttachment
Dim Base64 As String = Me.Request("Image")
'UW.JSON.WriteErrorMessage(Base64)
'Return
Dim imageBytes As Byte() = Convert.FromBase64String(Me.Request("Image"))
Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream(imageBytes, 0, imageBytes.Length)
ms.Write(imageBytes, 0, imageBytes.Length)
Dim image As System.Drawing.Image = System.Drawing.Image.FromStream(ms, True)
Dim map As Bitmap
Dim Filename As String = Now.ToString("yyyyMMddHHmmssfff") & ".png"
Try
System.IO.Directory.CreateDirectory(DB.sysconfig.Path.TaskAttachment & "UploadImages")
image.Save(DB.sysconfig.Path.TaskAttachment & "UploadImages\" & Filename, System.Drawing.Imaging.ImageFormat.Png)
UW.JSON.WriteSuccessMessage(DB.sysconfig.URL.TaskAttachment & "UploadImages/" & Filename)
Catch ex As Exception
UW.JSON.WriteErrorMessage(ex.ToString)
End Try
End Sub
End Class
<a href='#' style="background-color:#cccccc; color=black; padding: 3px; margin:6px 6px 6px 6px;">AA</a>
<a href='#' style="background-color:#cccccc; color=black; padding: 3px; margin:6px 6px 6px 6px;">BB</a>
--> 其中因為 a 是 inline 物件, margin 的 Top 會被略過
<div style="margin-top:6px;">
<a href='#' style="background-color:#cccccc; color=black; padding: 3px; margin:6px 6px 6px 6px;">AA</a>
<a href='#' style="background-color:#cccccc; color=black; padding: 3px; margin:6px 6px 6px 6px;">BB</a>
</div>
<div id="divContent" style="border:1px solid black">ABCDE</div>
--> 寬divContent 的度隨內文變化
<div style="width:1000px"><div id="divContent" style="border:1px solid black">ABCDE</div></div>
--> divContent 的寬度會和父容器相同
<div style="width:1000px"><div id="divContent" style="border:1px solid black; display:inline">ABCDE</div></div>
--> divContent 的寬度會和父容器相同
<script type="text/javascript" src="/scripts/jquery.ae.image.resize.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("div._content img").aeImageResize({ width: 250 });
});
</script>
<script type="text/javascript">
$(document).ready(function () {
$(".resizeme").aeImageResize({ width: 450 });
});
</script>