clear 方法用于删除选中的内容,选中的内容可以是文字也可以是控件,可以是文本框中的文字,也可以是静态的文字。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>document.selection 的 clear</title> </head> <body> <div>请选中这里的部分文字。</div> <div><input type="button" value="请选中部分文字,然后点击这里执行 clear" onclick="javascript:Foo();" /></div> <script type="text/javascript" language="javascript"> <!-- function Foo() { document.selection.clear(); } --> </script> </body> </html>[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
创建于2005年 渝ICP备05010272号-1
电邮:cftea@126.com