<script type="text/javascript">
//<![CDATA[
function foo(){
var a=null; var s='';
if (document.all) {
a=document.selection.createRange();
s=a.text
} else {
a=window.getSelection();
s=a.toString();
}
alert(s)
}
//]]>
</script>
<body id="www.never-online.net">
<button onclick=foo()>get</button>
aaaaaaaaaaaaaaa
</body>
//<![CDATA[
function foo(){
var a=null; var s='';
if (document.all) {
a=document.selection.createRange();
s=a.text
} else {
a=window.getSelection();
s=a.toString();
}
alert(s)
}
//]]>
</script>
<body id="www.never-online.net">
<button onclick=foo()>get</button>
aaaaaaaaaaaaaaa
</body>
如IE下:
<script type="text/javascript">
function foo(b){
var a=null; var s='';
a=document.selection.createRange();
s=a.htmlText;
alert(s)
if(b){
a.pasteHTML("linux");
}
} </script>
<body id="www.never-online.net">
<div>abc</div><i>window</i>
<button onclick=foo()>get</button>
<button onclick=foo(true)>Set</button>
</body>这样的代码在FF下怎么写?大家帮帮我啊!