abstrakt:<!DOCTYPE html><html> <head> &nbs
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
*{margin:0 auto;}
div{
margin:50px auto;
border:1px solid #ccc;
border-radius:6px;
width:500px;
height:300px;
padding:10px;
}
#nav_menu{
width:100px;
height:30px;
border-radius:6px;
border:1px solid blue;
color:red;
line-height:30px;
text-align:center;
font-size:14px;
position:fixed;
left:0px;
top:0px;
display:none;
background:#fff;
}
#nav_menu button{
border:none;
background:transparent;
cursor:pointer;
}
</style>
</head>
<body>
<div id='content' onmouseup='selec()'>
前勞斯萊斯規(guī)劃履行官吉爾斯泰勒現(xiàn)已搬到一汽轎車部門紅旗,從事豪華車的出產(chǎn)。該品牌轉(zhuǎn)換為“紅旗”,出產(chǎn)一些最貴重的中國轎車。賈爾斯泰勒具有26年轎車規(guī)劃生計,曾先后服務(wù)于雪鐵龍、捷豹和勞斯萊斯品牌,主導(dǎo)規(guī)劃了雪鐵龍C3概念車和捷豹XJ、XK等車型。來源:百家號
</div>
<p id='nav_menu'><button onclick="copyText()">復(fù)制</button>|<button onclick="seatchText()">搜索</button></p>
<script type="text/javascript">
var sele_text=window.getSelection();
var def_p=document.getElementById('nav_menu');
function selec(event){
var e=event||window.event;
var m_x=e.clientX;
var m_y=e.clientY;
console.log(sele_text);
if(sele_text.toString().length>0){
def_p.style.display='block';
def_p.style.left=m_x+'px';
def_p.style.top=m_y+'px';
}
else{
def_p.style.display='none'; //alert(sele_text);
}
}
function copyText(){
document.execCommand('Copy');
def_p.style.display='none';
}
function seatchText(){
window.location.href="https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=monline_4_dg&wd="+sele_text;
}
</script>
</body>
</html>
Korrigierender Lehrer:查無此人Korrekturzeit:2019-05-13 09:32:20
Zusammenfassung des Lehrers:完成的不錯。js很重要,功能也很強(qiáng)大。繼續(xù)加油。