摘要:
由于安全原因,JS操作浏览器的file控件时只能读,不能改。解决方法也很简单,就是使用outerHTML去重置:<input type="file" /><script>document.getElementById('myfile').outerHTML = document.getElementById('myfile').outerHTML;</script>很简单吧! 阅读全文
posted @ 2013-03-05 17:06
凉粉侠
阅读(246)
评论(0)
推荐(0)
摘要:
<!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=utf- 阅读全文
posted @ 2013-03-05 15:14
凉粉侠
阅读(130)
评论(0)
推荐(0)
摘要:
/**** Base64 encode / decode** @author haitao.tu* @date 2010-04-26* @email tuhaitao@foxmail.com**/ function Base64() { // private property _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; // public method for encoding this.encode = function (input) ... 阅读全文
posted @ 2013-03-05 15:00
凉粉侠
阅读(167)
评论(0)
推荐(0)
摘要:
某日写代码的时候,发现img.onload中无法获取图片的宽度和高度,代码如下:<img src="" style="display:none"><button>click me</button><script>var img = document.getElementsByTagName('img')[0];var button = document.getElementsByTagName('button')[0];button.onclick = function(){ 阅读全文
posted @ 2013-03-05 14:51
凉粉侠
阅读(2068)
评论(1)
推荐(0)
摘要:
今天发现chrome下的一个小问题,当img.src重复设置为相同值的时候,img.onload不会重复执行。<img src=""><button>click me</button><script>var img = document.getElementsByTagName('img')[0];var button = document.getElementsByTagName('button')[0];var count = 0;button.onclick = function(){ i 阅读全文
posted @ 2013-03-05 14:26
凉粉侠
阅读(3416)
评论(2)
推荐(0)