blob: f38e1bfb4e8da11e2e2ca71731b9578c3c3f9f6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Large text selection drag and drop</title>
<style type="text/css">
textarea
{width:300px;
height:100px;
margin-top:20px;
padding:10px;}
</style>
<script type="application/ecmascript">
function start(event)
{var p = document.querySelector('p:last-child'), s = p.firstChild.nodeValue;
for(var i = 0; i != 12; i++)
{s = s + ' ' + s;}
p.firstChild.nodeValue = 'Start of selection. ' + s + ' End of selection';
window.getSelection().selectAllChildren(p);}
</script>
</head>
<body onload="start()">
<p>Try to drag selection below to the textarea. Copy of selection should end up in the textarea once you drop it there.</p>
<p><textarea placeholder="Drop selection here"/></p>
<p>Large selection.</p>
</body>
</html>
|