This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 只支持chrome | |
**/ | |
function downloadFile (type, filename, filecon) { | |
filename = prompt('填写保存的名字', filename); | |
var blob = new Blob([filecon], { type: type }); | |
var url = window.webkitURL.createObjectURL(blob); | |
var a = document.createElement("a"); | |
a.download = filename; | |
a.href = url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 把byte[]转换为字符串 | |
* 转换失败返回null | |
*/ | |
public String byte2str(byte[] bytes){ | |
String s = null; | |
try { | |
s = new String(bytes, "UTF8"); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 解析ISO时间 | |
* | |
* 如果是两天内,格式为:“今天 08:08”"昨天 16:18" | |
* 如果是两天前,格式为:"月-日" | |
* | |
*/ | |
public String ISOTimeFormat(String isotime) { | |
java.text.DateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'"); | |
sdf.setTimeZone(TimeZone.getTimeZone("GMT")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.fixview; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.GridView; | |
/** | |
* Created by new on 14-10-13. | |
* 纯粹是为了修复GridView在wrap_content下只显示一半的问题 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dropbox = $$("#canvas")[0]; | |
dropbox.ondragenter = function (e) { | |
e.preventDefault(); | |
dropbox.innerHTML = "松开鼠标"; | |
} | |
dropbox.ondragleave = function (e) { | |
e.preventDefault(); | |
dropbox.innerHTML = "图片拖放至此"; | |
} | |
dropbox.ondragover = function (e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 针对现代浏览器 | |
* 1. 设置content为空格是为了避免opera下的一个bug,该bug当除了document外 | |
* 的任何地方添加了contenteditable节点时会触发。 | |
* 不然会导致标签清完浮动后出现上下留白。 | |
* 2. 使用table而非block的必要在于:‘:before’可以把子元素的top-margins包 | |
* 含在内。 | |
* | |
*/ | |
.cf:before, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title></title> | |
<meta charset='utf-8' /> | |
</head> | |
<body> | |
<canvas id="a" width='1000' height="1000" style="border:1px solid red;"></canvas> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div>\||di\|v|ab\@ca@大点的a:吧啊</div> | |
<script> | |
var str = document.querySelector("div").innerHTML; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div id="out"> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var domParser = document.createElement("div"); | |
var html = "<td>123</td>"; | |
// 设置 | |
domParser.innerHTML = html; | |
//打印 | |
console.log(domParser.innerHTML); // "123",td标签丢失了。 |
NewerOlder