四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

javascript實現(xiàn)劃詞標記+劃詞搜索功能

復制代碼 代碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>Untitled Document</title> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
</head> 

<body> 


<SCRIPT language=Javascript> 
<!-- 

document.body.onload=adddiv; 
document.onmousedown=recordobj; 
document.ondblclick=dbclick; 
document.onmouseup=showselect; 
var starobj,isdb=false,allow=true; 

function isallow() 

if(allow){ 
allow=false; 
alert('is closed'); 

else{ 
allow=true; 
alert('is opend'); 




function dbclick() 

isdb=true; 

function recordobj() 

starobj=event.srcElement; 

function showselect() { 
var str=""; 
if(event.srcElement.tagName!="A"&&event.srcElement.tagName!="INPUT"&&event.srcElement==starobj&&!isdb&&allow) 

var oText=document.selection.createRange(); 

if(oText.text.length>0) 

str=oText.text; 
oText.text="BuB"+oText.text+"EuE"; 



oText.select(); 
event.srcElement.innerHTML=event.srcElement.innerHTML.replace("BuB","<u style='FONT-WEIGHT: bold;COLOR: #ff3366'>").replace("EuE","</u>"); 



searchgoogle(str) 
isdb=false; 


function searchgoogle(str) 

var obj=document.getElementById("searchgoogle"); 
if(str.length>0) 

obj.style.display="block"; 
obj.style.position="absolute"; 
obj.style.zindex=999; 
obj.style.posTop=document.body.scrollTop+event.y-25; 
obj.style.posLeft=document.body.scrollLeft+event.x+5; 
obj.style.widht=80; 
obj.innerHTML="<a target=_blank href=http://www.google.com/search?ie=UTF-8&oe=UTF-8&q="+str+" style='BORDER-RIGHT: royalblue thin solid; BORDER-TOP: royalblue thin solid; FONT-WEIGHT: bold; BORDER-LEFT: royalblue thin solid; CLIP: rect(auto auto auto auto); COLOR: #ffffff; BORDER-BOTTOM: royalblue thin solid; BACKGROUND-COLOR: inactivecaption; TEXT-DECORATION: none'>Search It!</a>"; 


else 

obj.style.display="none"; 



function adddiv() 

var mobj = document.createElement("div"); 

mobj.id="searchgoogle"; 

document.body.appendChild(mobj); 


//--> 
</SCRIPT> 
<INPUT type="button" onclick="isallow()" value="關(guān)閉/打開劃詞功能"> 
<p>qrasfdasfasfdasfsafasdfsafsafasdfasdfasd</p> 
</body> 
</html> 


在頁面中加上這串代碼就行了,同時還有搜索功能。演示效果就請看本BLOG頁面上用鼠標劃選文字的效果

沒來得及整理代碼,看上去有點亂。

JavaScript技術(shù)javascript實現(xiàn)劃詞標記+劃詞搜索功能,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 清理垃圾360清理垃圾大师| 希比·布拉奇克| 纵横四海国语免费观看| 免费播放电影大全免费观看| 九九九九九九九九九九热| 显示驱动| 王者荣耀电视剧| 男生虐茎虐睾视频网站| 天下免费大全正版资料| winnie| 大学生职业规划ppt成品| 斯科特阿金斯主演所有电影| 阿芮尔·温特| 违规吃喝心得体会100字| 寻梦记| 七下英语第二单元作文| 王李| 乡村女教师乱淫交片| 超越天堂菲律宾| 国内自拍99| naughty america| 唐砖演员表| 寡妇 电影| 所求皆所愿| 上海东方卫视节目表| 泰诺对乙酰氨基酚缓释片说明书| 视频www| 叶子楣地下裁决| 山西影视频道| mariaarredondo| 赤月| 猫鼠| 幸福年简谱| 风筝 电影| 电影终结之战 电影| 如意电视剧| 刘亦菲mv| 袁鸿| 风花电影完整版免费观看| 美女亚洲| 肢体的诱惑电影|