Summary of the usage of document.execcommand of
- 2020-03-30 01:14:46
- OfStack
Case 1:
IsNaN tests whether the input is numeric or not, and limits the input to a numeric value such as 1981.121, allowing a maximum of one decimal point
<input type="text" name="text" onkeyup="if(isNaN(value))execCommand('undo')" />
Example 2:
<input type=button value= shear onclick=document.execCommand('Cut')>
<input type=button value= copy onclick=document.execCommand('Copy')>
<input type=button value= paste onclick=document.execCommand('Paste')>
<input type=button value= undo onclick=document.execCommand('Undo')>
<input type=button value= redo onclick=document.execCommand('Redo') id=button2 name=button2>
<input>
<input type=button value= delete onclick=document.execCommand('Delete')>
<input type=button value= blackbody onclick=document.execCommand('Bold')>
<input type=button value= italics onclick=document.execCommand('Italic')>
<input type=button value= The underline onclick=document.execCommand('Underline')>
<input type=button value= stop onclick=document.execCommand('stop')>
<input type=button value= save onclick=document.execCommand('SaveAs')>
<input type=button value= Save as onclick=document.execCommand('Saveas',false,'c:\test.htm')>
<input type=button value= The font onclick=document.execCommand('FontName',false,fn)>
<input type=button value= The font size onclick=document.execCommand('FontSize',false,fs)>
<input type=button value= The refresh onclick=document.execCommand('refresh',false,0)>