HTML5是否允许您从Web浏览器中与本地客户端文件进行交互?
不可以,HTML5不允许您直接与本地客户端文件进行交互。您可以为此使用拖放或FileSystemAPI。
示例
让我们看一个使用HTML5在网络浏览器上拖放的示例-
<!DOCTYPE HTML>
<html>
<head>
<style>
#boxA, #boxB {float:left;padding:10px;margin:10px; -moz-user-select:none;}
#boxA { background-color: #6633FF; width:75px; height:75px; }
#boxB { background-color: #FF6699; width:150px; height:150px; }
</style>
<script>
function dragStart(ev) {
ev.dataTransfer.effectAllowed='move';
ev.dataTransfer.setData("Text", ev.target.getAttribute('id'));
ev.dataTransfer.setDragImage(ev.target,0,0);
return true;
}
</script>
</head>
<body>
<center>
<h2>Drag and drop HTML5 demo</h2>
<div>Try to drag the purple box around.</div>
<div id = "boxA" draggable = "true"
ondragstart = "return dragStart(ev)">
<p>Drag Me</p>
</div>
<div id = "boxB">Dustbin</div>
</center>
</body>
</html>热门推荐
10 信耶稣的人祝福语简短
11 初升高祝福语家长简短
12 高考前祝福语简短字句
13 诗词文案祝福语简短精辟
14 爸爸爱你祝福语大全简短
15 虎年开新车祝福语简短
16 蛋糕祝老师祝福语简短
17 整形机构开业祝福语简短
18 送女士祝福语长辈简短