Exportovat (0) Tisk
Rozbalit vše
EN
Tento obsah není k dispozici ve vašem jazyce, ale můžete využít tuto verzi v anglickém jazyce.
Toto téma nebylo dosud ohodnoceno - Ohodnotit toto téma

beforecut | onbeforecut event

Fires on the source object before the selection is deleted from the document.

Syntax

HTML Attribute <element onbeforecut = "handler(event)">
Event Property object.onbeforecut = handler;
attachEvent Method object.attachEvent("onbeforecut", handler)
addEventListener Method object.addEventListener("beforecut", handler, useCapture)

Event information

SynchronousNo
BubblesYes
CancelableYes

Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Standards information

There are no standards that apply here.

Remarks

Creating custom code for cutting requires several steps:

  1. Set event.returnValue=false in the onbeforecut event to enable the Cut shortcut menu item.
  2. Specify a data format in which to transfer the selection through the setData method of the clipboardData object.
  3. Invoke the setData method in the oncut event.

None.

To invoke this event, do one of the following:

  • Right-click to display the shortcut menu and select Cut.
  • Or press CTRL+X if the selection is within a text field.

The pEvtObj parameter is required for the following interfaces:

Examples

This example uses the setData and getData methods with the clipboardData object to perform a cut-and-paste operation through the shortcut menu.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onbeforecutEX.htm


<head>
<script>
var sSave = "";
function fnBeforeCut() {
   event.returnValue = false;
}
function fnCut() {
   event.returnValue = false;
   sSave = oSource.innerText;
   oSource.innerText = "";
}
function fnBeforePaste() {
   event.returnValue = false;
}
function fnPaste() {
   event.returnValue = false;
   oTarget.innerText = sSave;
}
</script>
</head>
<body>
<div id="oSource" class="selectandcut" 
    onbeforecut="fnBeforeCut()" 
    oncut="fnCut()">Select and Cut this Text 
</div>
<br>
<br>
<div id="oTarget" class="pastehere" 
    onbeforepaste="fnBeforePaste()" 
    onpaste="fnPaste()">Paste the Text Here 
</div>
</body>

See also

a
address
applet
area
b
bdo
big
blockQuote
body
button
caption
center
cite
code
custom
dd
dfn
dir
div
dl
dt
em
embed
fieldSet
font
form
hn
hr
i
img
input type=button
input type=checkbox
input type=email
input type=file
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
kbd
label
legend
li
listing
map
marquee
menu
nextID
noBR
ol
p
plainText
pre
rt
ruby
s
samp
select
small
span
strike
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
tr
tt
u
ul
var
xmp
Reference
onbeforecopy
onbeforepaste
oncopy
oncut
onpaste
setData
Conceptual
About DHTML Data Transfer

 

 

Byl tento obsah pro vás užitečný?
(Zbývající počet znaků: 1500)
Děkujeme za váš názor.
Zobrazit:
© 2014 Microsoft. Všechna práva vyhrazena.