//코드 단어 검색
var GLS = {};
GLS.startObj = null;
GLS.isdb = false;
GLS.allow = true; () {
if (GLS.allow) {
GLS.allow = false
alert('Google 검색이 종료되었습니다.')
}
else {
GLS.allow; = true;
alert('Google 검색이 열려 있습니다.');
GLS.dblclick = function() {
GLS.isdb = true;
GLS.mousedown = function(evt) {
evt = (evt) ? evt : ((window.event) ? window.event : ""); .startObj = (evt .target) ? evt.srcElement;
}
};
GLS.mouseup = function(evt) {
var obj;
evt = (evt) ? evt : ((window.event) ? window.event : "")
if (evt) {
obj = (evt.target) ? .srcElement;
strlen = window.getSelection ? window.getSelection().toString() : document.selection.createRange().text;
}
var str = ""
obj.tagName != "A" && obj.tagName != "INPUT" && obj == GLS.startObj && !GLS.isdb && GLS.allow) {
if (strlen.length > 0) {
str = strlen;
}
GLS.search(str, evt);
GLS.isdb = false
}; evt) {
var obj = $("#GLSearch");
var sDivWidth = 88; //검색창의 너비 "Google 검색"
if (str.toString().length > ; 0) {
var windowWidth; //창 너비
//창 너비 가져오기
if (self.innerWidth) {
windowWidth = self.innerWidth; } else if (document.documentElement && document.documentElement .clientWidth) {
windowWidth = document.documentElement.clientWidth;
} else if (document.body) {
windowWidth = document.body.clientWidth; 🎜>}
obj.css({ 'display': 'block', 'position': 'absolute', 'zindex': '10000' })
var rX, rX, wT; if ($.browser.msie) {
wT = (evt.clientX sDivWidth) - windowWidth;
rY = document.documentElement.scrollTop evt.clientY
rX = document.documentElement.scrollLeft evt.clientX; ;
rY = (evt.clientY < ; 25) ? rY 5 : rY - 25
rX = (wT > 0) ? rX - wT : rX 5;
var sT = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop;
wT = (evt.pageX sDivWidth) -
rY = (( evt.pageY - sT) < 25) ? evt.pageY - 25
rX = (wT > 0) ? evt.pageX 5; 🎜>obj.css("top", rY );
obj.css("left", rX)
obj.html("
Google 검색");
}
else {
obj.css("display" , "none");
}
};
//페이지 로딩
$(document).ready(function() {
$(document.body).append ("
")
$(document).mousedown(GLS.mousedown).dblclick(GLS.dblclick ).mouseup(GLS.mouseup)
});
CSS 첨부/*search*/
코드 복사
코드는 다음과 같습니다.
a.GL_s{width:68px;height:20px;display:block;border:solid 1px #2b7ab7;line-height:20px ;패딩-왼쪽:18px;색상:#084f10; 글꼴 크기:12px;글꼴-가중치:bold;배경:url(search.gif) 왼쪽 반복 없음;텍스트-장식:없음;}
a.GL_s :link{filter:alpha(opacity=71); -moz-opacity:0.7;불투명도: 0.7;}
a.GL_s:hover{filter:alpha(opacity=100);-moz-opacity:1.0;opacity : 1.0;}