有别人问javascript中对粘贴板的操作,以及如何运用。
clipboardDate对象,对粘贴板的操作。
clearDate("Text") 清空粘贴板。
getData("Text")读取粘贴板。
setData("Text")
例子:
<input type="text" name="txtcopy" />
<input type="text" name="txtcopyed" />
<input type="button" value="放到粘贴板" οnclick="javascrop:clipboardData.setData('Text',txtcopy.value)" />
<input type="button" value="获取粘贴板" οnclick="javascrop:txtcopyed.value=clipboardData.getData('Text')" />
错误用法:(我那个朋友就是这样用,运行有问题了。呵呵,希望不要犯这样的迷糊。)
<input type="button" value="放到粘贴板" οnclick="clipboardData.setData('Text',txtcopy.value)" />
<input type="button" value="获取粘贴板" οnclick="txtcopyed.value=clipboardData.getData('Text')" />
因目前JAVASCRIPT限制,粘贴板只能用到Text,看以后发展了,你会了没有,给分哦。