JAVA SCRIPT
16. Меню, перемещаемое в любое место на экране с помощью мыши.
#superbest { position: absolute; left: 15; top: 150; width: 125; visibility: visible; z-index: 10; }
function heartBeat() { if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; } if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; } if(diffY != lastScrollY) { percent = .1 * (diffY - lastScrollY); if(percent > 0) percent = Math.ceil(percent); else percent = Math.floor(percent); if(IE) document.all.superbest.style.pixelTop += percent; if(NS) document.superbest.top += percent; lastScrollY = lastScrollY + percent; } if(diffX != lastScrollX) { percent = .1 * (diffX - lastScrollX); if(percent > 0) percent = Math.ceil(percent); else percent = Math.floor(percent); if(IE) document.all.superbest.style.pixelLeft += percent; if(NS) document.superbest.left += percent; lastScrollX = lastScrollX + percent; } } function checkFocus(x,y) { stalkerx = document.superbest.pageX; stalkery = document.superbest.pageY; stalkerwidth = document.superbest.clip.width; stalkerheight = document.superbest.clip.height; if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true; else return false; } function grabIt(e) { if(IE) { whichIt = event.srcElement; while (whichIt.id.indexOf("superbest") == -1) { whichIt = whichIt.parentElement; if (whichIt == null) { return true; } } whichIt.style.pixelLeft = whichIt.offsetLeft; whichIt.style.pixelTop = whichIt.offsetTop; currentX = (event.clientX + document.body.scrollLeft); currentY = (event.clientY + document.body.scrollTop); } else { window.captureEvents(Event.MOUSEMOVE); if(checkFocus (e.pageX,e.pageY)) { whichIt = document.superbest; StalkerTouchedX = e.pageX-document.superbest.pageX; StalkerTouchedY = e.pageY-document.superbest.pageY; } } return true; } function moveIt(e) { if (whichIt == null) { return false; } if(IE) { newX = (event.clientX + document.body.scrollLeft); newY = (event.clientY + document.body.scrollTop); distanceX = (newX - currentX); distanceY = (newY - currentY); currentX = newX; currentY = newY; whichIt.style.pixelLeft += distanceX; whichIt.style.pixelTop += distanceY; if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop; if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft; if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20; if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5; event.returnValue = false; } else { whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY); if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset; if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset; if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17; if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17; return false; } return false; } function dropIt() { whichIt = null; if(NS) window.releaseEvents (Event.MOUSEMOVE); return true; } if(NS) { window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN); window.onmousedown = grabIt; window.onmousemove = moveIt; window.onmouseup = dropIt; } if(IE) { document.onmousedown = grabIt; document.onmousemove = moveIt; document.onmouseup = dropIt; } if(NS || IE) action = window.setInterval("heartBeat()",1); // -->
#pulldownButton {position: absolute; z-index: 59800; left: 100px; top: 60px;} #pulldownMenu {position: absolute; z-index: 59900; visibility: hidden; left: 100px; top: 116px;}
var visibleVar="null"; function init(){ if (navigator.appName == "Netscape") {layerStyleRef="layer.";layerRef="document.layers";styleSwitch="";visibleVar="show";} else{layerStyleRef="layer.style.";layerRef="document.all";styleSwitch=".style";visibleVar="visible";} } function showHideLayerSwitch(layerName) {if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility == visibleVar')) {hideLayer(layerName);} else{showLayer(layerName);} } function showLayer(layerName) {eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"'); } function hideLayer(layerName) {eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"'); } function showLayer1(layerName) {if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility == visibleVar')) {showLayer(layerName); } } function hideLayer1(layerName) {if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility == visibleVar')) {hideLayer(layerName); } }
Ссылка или рисунок - при клике появляется меню Раздел 1 Раздел 2 Раздел 3 Link 1.1 Link 2.1 Link 3.1 Link 1.2 Link 2.2 Link 3.2 Link 1.3 Link 2.3 Link 3.3
18. Окно открывается в полном экране.
url = "ajs18_a.htm"; var speedX = 7; var speedY = 5; var bgColor = "#000000"; var txtColor = "#FF80000"; if (document.all){ var wide = window.screen.availWidth; var high = window.screen.availHeight; } function andBoom(){ if (document.all){ var Boomer = window.open("","BoomWindow","fullscreen"); Boomer.document.write('Loading... Используются технологии uCoz '); Boomer.focus(); for (H=1; H
19. Info за курсором мыши.
var x,y var step=10 var flag=0 var message="Java Script на www.acidic.narod.ru/" message=message.split("") var xpos=new Array() for (i=0;i<=message.length-1;i++) { xpos[i]=-50 } var ypos=new Array() for (i=0;i<=message.length-1;i++) { ypos[i]=-50 } function handlerMM(e){ x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY flag=1 } function makesnake() { if (flag==1 && document.all) { for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; i=1; i--) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; i
20. Эффект печатной машинки.
var strText = ""; function showtext(i) { var HTMLtag = 0; for (count=4; i < strText.length && count > 0; i++) { if (strText.charAt(i) == "<" || strText.charAt(i) == ">") HTMLtag = !HTMLtag; if (!HTMLtag) count--; } document.all["myBlock"].innerHTML = strText.substr(0, i); if (i < strText.length) setTimeout("showtext(" + i + ")", 20); } function doit() { strText = document.all["myBlock"].innerHTML; document.all["myBlock"].innerHTML = ""; document.all["myBlock"].style.visibility = "visible"; setTimeout("showtext(0)", 100); }
[1] [2] [3] 4 [5] [6] [7] [8] [9] [10]
Ваше имя:
Ваш Script (прикрепить):
Введите краткую информацию о Scriptе:
Введите Ваш e-mail:
[наверх]
*** Главная страница сайта ***
Все новости *** Переводчик *** Развлечение *** Фобии
On-line Тесты *** Субъекты РФ *** Ссылки *** Gif Animation
Java Script *** Почётные грамоты ***Обмен баннерами
Карта сайта *** Гостевая книга *** E-mail
Copyright © 2002-2003