Phiên bản đầy đủ: jsB@nk » Trình đơn » Menu được điều khiển bởi người dùng
URL: https://www.javascriptbank.com/user-controlled-menu.html
Đoạn mã này tạo ra một trình đơn có thể được di chuyển trên trang web bởi người dùng.
Phiên bản đầy đủ: jsB@nk » Trình đơn » Menu được điều khiển bởi người dùng
URL: https://www.javascriptbank.com/user-controlled-menu.html
<style type="text/css"><!--span#DHTML-Hawaii a { color:#00ff00;font-weight:bold;}span#DHTML-Hawaii a:hover { color:white;}form#Form-Dynamics input.controls { background-color:black;color:#00ff00;font-weight:bold;border:2px outset #00ff00; }--></style><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<script language="JavaScript" type="text/javascript"><!--var WIDTH="500";var HEIGHT="200";var COLOR="white";var BGCOLOR="black";var TEXTALIGN="center";var BORDER="2 outset #00ff00";var ZINDEX=1;var POSITION="absolute";var TOP=-20;var LEFT=0;var T=10,Time;var mdown=false;var mesg=new Array();mesg=["<h1>DYNAMIC SCRIPTS</h1><a href='http://JavaScriptBank.com/'>http://JavaScriptBank.com/</a><br />Home of Quality JavaScript and DHTML Effects<br /><br />","<h1>DYNAMIC SCRIPTS</h1>Thank You for Visiting JSBank<br /><br />Feel Free to browse around and to use as many scripts as you like.<br /><br />","<h1>DYNAMIC SCRIPTS</h1>The JavaScripts are ALL FREE<br />Have Fun!<br /><br />","<h1>DYNAMIC SCRIPTS</h1>If you have any Questions or Comments, hit the contact link and say what's on your mind."];window.onload=DYNAMICSCRIPTS;window.document.onmousemove=followCursor;//window.document.onmouseup=MUP;if(navigator.appName=="Netscape"){ document.captureEvents(Event.KEYCODE); document.captureEvents(Event.MOUSEMOVE)}window.document.onkeypress=keycapture;function keycapture(e){ if(navigator.appName=="Netscape") { if(e.keyCode==8) resetPos();else if(e.keyCode==13) MUP();else if(e.keyCode==45) showhide('visible');else if(e.keyCode==46) showhide('hidden'); } else {if(event.keyCode==13) MUP();else if(event.keyCode==83) showhide('visible');else if(event.keyCode==72) showhide('hidden');else setPos();}}function setPos(e){ Top=(navigator.appName=="Netscape")?e.PageY:event.clientY;Left=(navigator.appName=="Netscape")?e.PageX:event.clientX;document.getElementById('DHTML-Kaneohe').style.position="absolute";document.getElementById('DHTML-Hawaii').style.position="absolute";document.getElementById('DHTML-Kaneohe').style.left=Left-50;document.getElementById('DHTML-Kaneohe').style.top=Top-20; document.getElementById('DHTML-Hawaii').style.left=Left-50;document.getElementById('DHTML-Hawaii').style.top=Top; }function DYNAMICSCRIPTS(){ creatBase();}function creatBase(){ creatSpan(" -> CLICK HERE AND DRAG <-","DHTML-Kaneohe",WIDTH,"20","white","darkblue","center",BORDER,2,POSITION,0,LEFT) creatSpan(mesg[0]+"<form><input type='button' value='Next >>' onclick='nextMesg(1);' /></form>","DHTML-Hawaii",WIDTH,HEIGHT,COLOR,BGCOLOR,TEXTALIGN,BORDER,ZINDEX,POSITION,0,LEFT);window.document.getElementById('DHTML-Kaneohe').onmousedown=MDOWN;window.document.getElementById('DHTML-Kaneohe').onmouseup=MUP;window.document.getElementById('DHTML-Hawaii').onmouseup=MUP;if(navigator.appName=="Netscape"){ resetPos();document.getElementById('DHTML-Kaneohe').style.left=10;document.getElementById('DHTML-Hawaii').style.left=10;} startAnim();}function creatSpan(HUCKO,IDNo,w,h,c,bc,ta,b,z,p,t,l){ RHucko1=document.createElement('span');with(RHucko1.style){ width=w;height=h;color=c;backgroundColor=bc;textAlign=ta;border=b;zIndex=z;position=p;top=t;left=l;}RHucko1.innerHTML=HUCKO;RHucko1.id=IDNo;document.getElementById('Richard_Hucko').appendChild(RHucko1);}function followCursor(e){if(mdown) { document.getElementById('DHTML-Kaneohe').style.left=(navigator.appName=="Netscape")?e.pageX-50:event.clientX-50;document.getElementById('DHTML-Kaneohe').style.top=(navigator.appName=="Netscape")?e.pageY-20:event.clientY-20; document.getElementById('DHTML-Hawaii').style.left=(navigator.appName=="Netscape")?e.pageX-50:event.clientX-50;document.getElementById('DHTML-Hawaii').style.top=(navigator.appName=="Netscape")?e.pageY:event.clientY; }}function MDOWN(){ document.getElementById('DHTML-Kaneohe').style.position="absolute"; document.getElementById('DHTML-Hawaii').style.position="absolute"; mdown=true;}function MUP(){ mdown=false;document.getElementById('DYNAMICHTML').focus();}function resetPos(){ document.getElementById('DHTML-Kaneohe').style.position="absolute"; document.getElementById('DHTML-Kaneohe').style.top=0;document.getElementById('DHTML-Kaneohe').style.left=0;document.getElementById('DHTML-Hawaii').style.position="absolute";document.getElementById('DHTML-Hawaii').style.top=20;document.getElementById('DHTML-Hawaii').style.left=0;}function showhide(JAVASCRIPTS){ document.getElementById('DHTML-Kaneohe').style.visibility=JAVASCRIPTS; document.getElementById('DHTML-Hawaii').style.visibility=JAVASCRIPTS;}var cntr=0;var bool=true;function startAnim(){ if(cntr<WIDTH-10) { document.getElementById('DHTML-Kaneohe').style.width=cntr; document.getElementById('DHTML-Hawaii').style.width=cntr;cntr+=10; } else if(bool) { clearTime();bool=false;resetPos(); } Time=setTimeout("startAnim();",T);}function clearTime(){ clearTimeout(Time);}function nextMesg(next){ document.getElementById('DHTML-Hawaii').innerHTML=(next==mesg.length-1)?mesg[next]+"<form><input type='button' value='Back To First >>' onclick='nextMesg(0);' /></form>":mesg[next]+"<form><input type='button' value='Next >>' onclick='nextMesg("+eval(next+1)+");' /></form>";}//--></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form name="Dynamic-Control" id="Form-Dynamics"> <input type="button" class="controls" value="Reset Position" onclick="resetPos();" /> <input type="button" class="controls" value="Show" onclick="showhide('visible')" /> <input type="button" class="controls" value="Hide" onclick="showhide('hidden')" /></form><div id="Richard_Hucko" name="APPEND_HERE"></div><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->