Đoạn mã javascript giúp thay đổi giao diện của Trình Menu khi click chuột phải vào website.
<script type='text/javascript'>
//<![CDATA[
document.write('<style>');
document.write('.awem3NBSPM { BORDER-RIGHT: #0a9df5 1px solid; BORDER-TOP: #0a9df5 1px solid; FONT-WEIGHT: normal; FONT-SIZE: 12px; Z-INDEX: 1000; VISIBILITY: hidden; BORDER-LEFT: #0a9df5 1px solid; WIDTH: 170px; CURSOR: hand; COLOR: #ffffff; LINE-HEIGHT: 20px; BORDER-BOTTOM: #0a9df5 1px solid; FONT-STYLE: normal; FONT-FAMILY: arial,helvetica,verdana; POSITION: absolute; BACKGROUND-COLOR: #0a9df5; }');
document.write('.awemnbspm { PADDING-LEFT: 21px; TEXT-ALIGN: left; } ');
document.write('.awemnbspm2 { PADDING-LEFT: 21px; TEXT-ALIGN: left; CURSOR: default; }');
document.write('.awemnbspm3 { PADDING-LEFT: 9px; TEXT-ALIGN: left; CURSOR: default; FONT-STYLE: bold; BACKGROUND-COLOR: #35587E;}');
document.write('DIV.c1 { Z-INDEX: 1; LEFT: -27px; WIDTH: 33px; POSITION: absolute; TOP: 107px; HEIGHT: 31px }');
document.write('</style>');
px = "px";
timer1 = null;
var decrease = 0.1;
var offset = 0;
var selected_id = null;
function getPosition(id)
{
endPos = id.offsetTop;
}
function actionMenu(obj,steps)
{
if (document.getElementById)
{
el = document.getElementById(obj) ;
}
el.xpos = el.offsetTop;
if (el.xpos < endPos)
{
clearTimeout(timer1);
}
else if (el.xpos >= endPos)
{
clearTimeout(timer1);
}
distance = endPos - el.xpos + offset;
steps = distance*decrease;
el.xpos += steps;
el.style.top = el.xpos+px ;
timer1= setTimeout("actionMenu('" + obj + "')",25);
}
document.write('<div class="awem3NBSPM" id="awem2NBSPM" onmouseover="Awemnbspm(event)" style="visibility: hidden; left: 437px; top: 150px;" onclick="awEmnbspm(event)" onmouseout="aWemnbspm(event)" display:none="">');
document.write('<DIV class=c1 id=pointer><IMG src="http://2.bp.blogspot.com/-dN_0zHfmk0g/T_Ku5zpRLoI/AAAAAAAAIuc/5EzqxesPbjg/s1600/code1k.com-dog.gif" border=0> </DIV>');
document.write('<b><div onmouseover="getPosition(this);actionMenu(\'pointer\',\'20\')" style="background-color: rgb(10, 157, 245); color: rgb(255, 255, 255);" class="awemnbspm" description="" target="_self" url="#" op="1">Mở trang</div></b>');
document.write('<div onmouseover="getPosition(this);actionMenu(\'pointer\',\'20\')" style="background-color: rgb(10, 157, 245); color: rgb(255, 255, 255);" class="awemnbspm" description="" target="_blank" url="#" op="1">Mở trang ở cửa sổ mới</div>');
document.write('<div onmouseover="getPosition(this);actionMenu(\'pointer\',\'20\')" style="background-color: rgb(10, 157, 245); color: rgb(255, 255, 255);" class="awemnbspm" description="" target="_self" url="http://www.code1k.com/">« Về trang chủ</div>');
document.write('<div class="awemnbspm3">Chuyên mục của web</div>');
document.write('<div onmouseover="getPosition(this);actionMenu(\'pointer\',\'20\')" style="background-color: rgb(10, 157, 245); color: rgb(255, 255, 255);" class="awemnbspm" description="Hướng dẫn và cung cấp con trỏ chuột" target="_self" url="http://www.code1k.com/search/label/Code%20m%E1%BB%9Bi?max-results=10">Code mới</div>');
document.write('<div onmouseover="getPosition(this);actionMenu(\'pointer\',\'20\')" style="background-color: rgb(10, 157, 245); color: rgb(255, 255, 255);" class="awemnbspm" description="Những biểu tượng icon định dạng png kích thước 16x16" target="_self" url="http://www.code1k.com/search/label/Th%E1%BB%A7%20thu%E1%BA%ADt?max-results=10">Thủ thuật</div>');
document.write('<div onmouseover="getPosition(this);actionMenu(\'pointer\',\'20\')" style="background-color: rgb(10, 157, 245); color: rgb(255, 255, 255);" class="awemnbspm" description="Những hình nền wallpaper đẹp" target="_self" url="http://www.code1k.com/search/label/Tin%20t%E1%BB%A9c?max-results=10">Tin tức</div>');
document.write('<div onmouseover="getPosition(this);actionMenu(\'pointer\',\'20\')" style="background-color: rgb(10, 157, 245); color: rgb(255, 255, 255);" class="awemnbspm" description="Flash nền đẹp cho website" target="_self" url="http://www.code1k.com/search/label/Vui%20l%E1%BA%A1?max-results=10">Vui lạ</div>');
document.write('<div class="awemnbspm2"><hr /></div>');
document.write('<div style="background-color: rgb(10, 157, 245); color: rgb(255, 255, 255);" class="awemnbspm2" description="Bản quyền của code1k.com" target="_self" url="http://www.blogger.com/profile/07223336277106475660">© Code1k.com 2012</div></div>');
var aweMnbspm=1;var AWemnbspm="#FFFFFF";var aWEmnbspm="#000000";var awEMnbspm="#0A9DF5";var AWEmnbspm="#FFFFFF";var aWEMnbspm=document.getElementById&&document.all;var AWEMnbspm=document.getElementById&&!document.all;if(aWEMnbspm||AWEMnbspm) {var awemNbspm=document.getElementById("awem2NBSPM");}
function AwemNbspm(e){
var tn=aWEMnbspm?event.srcElement:e.target;
if (tn + '' != '[object]')
{
var aweMNbspm=awemNbspm.getElementsByTagName("div");
if (tn.toString().indexOf('http:')==0 || tn.toString().indexOf('ftp:')==0 || tn.toString().indexOf('https:')==0 || tn.toString().indexOf('file:')==0)
{
//awemNbspm.style.visibility="hidden";
//return;
for ( i=0; i<aweMNbspm.length; i++)
{
try
{
if(aweMNbspm[i].getAttribute("op")=='1')
{
aweMNbspm[i].setAttribute("url",tn.toString());
aweMNbspm[i].style.display='';
}
}
catch (e){}
}
}
else
{
for ( i=0; i<aweMNbspm.length; i++)
{
try
{
if(aweMNbspm[i].getAttribute("op")=="1")
{
aweMNbspm[i].style.display="none";
}
}
catch (e){}
}
}
}
else
{
var aweMNbspm=awemNbspm.getElementsByTagName("div");
for ( i=0; i<aweMNbspm.length; i++)
{
try
{
if(aweMNbspm[i].getAttribute("op")=="1")
{
aweMNbspm[i].style.display="none";
}
}
catch (e){}
}
}
//alert(document.body.scrollTop);
var aWemNbspm=aWEMnbspm?document.body.clientWidth-event.clientX:window.innerWidth-e.clientX;
var awEmNbspm=aWEMnbspm?document.body.clientHeight-event.clientY:window.innerHeight-e.clientY;
//endPos = id.offsetTop;
if (aWemNbspm<awemNbspm.offsetWidth)
{
awemNbspm.style.left=aWEMnbspm? document.body.scrollLeft + event.clientX - awemNbspm.offsetWidth:window.pageXOffset+e.clientX-awemNbspm.offsetWidth;
}
else{
awemNbspm.style.left=aWEMnbspm? document.body.scrollLeft+event.clientX:window.pageXOffset+e.clientX;
}
var aweMNbspm=awemNbspm.getElementsByTagName("div");
if (awEmNbspm<awemNbspm.offsetHeight && (aWEMnbspm?event.clientY:e.clientY )>=awemNbspm.offsetHeight)
{
awemNbspm.style.top=aWEMnbspm? document.body.scrollTop+event.clientY-awemNbspm.offsetHeight:window.pageYOffset+e.clientY-awemNbspm.offsetHeight;
}
else
{
awemNbspm.style.top=aWEMnbspm? document.body.scrollTop+event.clientY:window.pageYOffset+e.clientY;
if (awEmNbspm<awemNbspm.offsetHeight)
{
awemNbspm.style.top = (aWEMnbspm? document.body.scrollTop+event.clientY:window.pageYOffset+e.clientY) - (awemNbspm.offsetHeight-awEmNbspm);
if (awemNbspm.style.top < (aWEMnbspm?document.body.scrollTop:window.pageYOffset))
awemNbspm.style.top = aWEMnbspm?document.body.scrollTop:window.pageYOffset;
}
}
awemNbspm.style.visibility="visible";return false;};
function AWemNbspm(e){awemNbspm.style.visibility="hidden";};
function Awemnbspm(e){var aWEmNbspm=aWEMnbspm? event.srcElement:e.target;if(aWEmNbspm.className=="awemnbspm"||AWEMnbspm&&aWEmNbspm.parentNode.className=="awemnbspm"){if(AWEMnbspm&&aWEmNbspm.parentNode.className=="awemnbspm"){aWEmNbspm=aWEmNbspm.parentNode;}var aweMNbspm=awemNbspm.getElementsByTagName("div");if(aWEMnbspm){
/* if(aweMNbspm[aweMNbspm.length-1].outerText.charAt(15)!=String.fromCharCode(84))return; */
}
//if(aweMNbspm[aweMNbspm.length-1].getAttribute("url").charAt(20)!=String.fromCharCode(111))return;
//if(aweMNbspm[aweMNbspm.length-1].getAttribute("description").charAt(22)!=String.fromCharCode(121))return;
aWEmNbspm.style.backgroundColor=AWemnbspm;aWEmNbspm.style.color=aWEmnbspm;if(aWEmNbspm.getAttribute("description")){window.status=aWEmNbspm.getAttribute("description");}else if (aWEmNbspm.getAttribute("url")){window.status=aWEmNbspm.getAttribute("url");}}};function aWemnbspm(e){var aWEmNbspm=aWEMnbspm?event.srcElement:e.target;if(aWEmNbspm.className=="awemnbspm"||AWEMnbspm&&aWEmNbspm.parentNode.className=="awemnbspm"){if(AWEMnbspm&&aWEmNbspm.parentNode.className=="awemnbspm"){aWEmNbspm=aWEmNbspm.parentNode;}var aweMNbspm=awemNbspm.getElementsByTagName("div");if(aWEMnbspm){
//if(aweMNbspm[aweMNbspm.length-1].outerText.charAt(15)!=String.fromCharCode(84))return;
}
//if(aweMNbspm[aweMNbspm.length-1].getAttribute("url").charAt(20)!=String.fromCharCode(111))return;
//if(aweMNbspm[aweMNbspm.length-1].getAttribute("description").charAt(22)!=String.fromCharCode(121))return;
aWEmNbspm.style.backgroundColor=awEMnbspm;aWEmNbspm.style.color=AWEmnbspm;window.status='';}};function awEmnbspm(e){var aWEmNbspm=aWEMnbspm?event.srcElement:e.target;if (aWEmNbspm.className=="awemnbspm"||AWEMnbspm&&aWEmNbspm.parentNode.className=="awemnbspm"){if (AWEMnbspm&&aWEmNbspm.parentNode.className=="awemnbspm"){aWEmNbspm=aWEmNbspm.parentNode;}var aweMNbspm=awemNbspm.getElementsByTagName("div");
if(aWEMnbspm){
//if(aweMNbspm[aweMNbspm.length-1].outerText.charAt(15)!=String.fromCharCode(84))return;
}
//if(aweMNbspm[aweMNbspm.length-1].getAttribute("url").charAt(20)!=String.fromCharCode(111))return;
//if(aweMNbspm[aweMNbspm.length-1].getAttribute("description").charAt(22)!=String.fromCharCode(121))return;
if (aWEmNbspm.getAttribute("target")&&(aWEmNbspm.getAttribute("target")!="_self")){window.open(aWEmNbspm.getAttribute("url"),aWEmNbspm.getAttribute("target"));}else{window.location=aWEmNbspm.getAttribute("url");}}};if (aWEMnbspm||AWEMnbspm){awemNbspm.style.display='';
document.oncontextmenu=AwemNbspm;document.onclick=AWemNbspm;};
//]]>
</script>
<!-- QUANGHIEN968.-->
No comments:
Post a Comment