标签:new blog not url 图片 could not nload javascrip return
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.clickBox{width:100px;height:20px;border:1px solid red;}
</style>
</head>
<body>
<script type="text/javascript">
var can="http://s1.hao123img.com/resource/site/img/logo.6456fa5.gif";
function D(url){
return new Promise(function(resolve, reject) {
var image = new Image();
image.onload = function() {
resolve(image);
};
image.onerror = function() {
reject(new Error(‘Could not load image at ‘ + url));
};
image.src = url;
});
}
D(can).then(function(value) {
alert(‘老二‘);
document.body.appendChild(value);
alert(‘老三‘);
});
alert(‘老大‘);
</script>
</body>
</html>
标签:new blog not url 图片 could not nload javascrip return
原文地址:http://www.cnblogs.com/taoxiaodan/p/6155791.html