WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A ball is attached to your mouse cursor with an elastic cord!
Categories : Java Script, DHTML, Graphics Update Picture
knik
Date : Jul 15th 2000
Grade : 3 of 5 (graded 12 times)
Viewed : 9989
File : ball.zip
Images : No Images for this code example.
Search : More code by knik
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<html>

<head>

<!-- The JavaScript below is copyright (C)2000 knik@crosswinds.net -->

<script type="text/javascript" language="JavaScript">
<!--
var NN=(navigator.appName == "Netscape" &&
navigator.userAgent.indexOf("Mozilla") != -1 &&
parseInt(navigator.appVersion) >= 4);
var IE=(navigator.userAgent.indexOf("MSIE") != -1 &&
navigator.userAgent.indexOf("Mozilla") != -1 &&
parseInt(navigator.appVersion) >= 4);
var layerRef="null",styleSwitch="null";
var mouseX=-8,mouseY=-8;
var X=-8,Y=-8;
var dX=0,dY=0;
var minX=0,minY=0;
var maxX=0,maxY=0;

function init() {
if (NN) {
layerRef = "document.layers";
styleSwitch = "";
eval(layerRef+'["body"]'+styleSwitch+'.width= window.innerWidth');
eval(layerRef+'["body"]'+styleSwitch+'.height= window.innerHeight');
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = mouseCoords;
moveBall();
}
if (IE) {
layerRef = "document.all";
styleSwitch = ".style";
eval(layerRef+'["ball"]'+styleSwitch+'.width= 14');
eval(layerRef+'["ball"]'+styleSwitch+'.height= 14');
document.onmousemove = mouseCoords
id = window.setInterval("moveBall()",5);
}
}
//-->
</script>

<script type="text/javascript" language="JavaScript 1.2">
<!--
function mouseCoords(e) {
if (NN) {
mouseX = e.pageX;
mouseY = e.pageY + 7;
}
if (IE) {
mouseX = document.body.scrollLeft + event.clientX;
mouseY = document.body.scrollTop + event.clientY + 7;
}
}

function moveBall() {
if (NN) {
minX = window.pageXOffset + 8;
minY = window.pageYOffset + 8;
maxX = window.pageXOffset + window.innerWidth - 8;
maxY = window.pageYOffset + window.innerHeight - 10;
}
if (IE) {
minX = document.body.scrollLeft + 8;
minY = document.body.scrollTop + 8;
maxX = document.body.scrollLeft + document.body.clientWidth - 8;
maxY = document.body.scrollTop + document.body.clientHeight - 12;
}
if (eval(layerRef+'["ball"]'+styleSwitch+'.visibility != "hide"')) {
X += dX/40;
Y += dY/40;
if (X < minX) {dX = -dX; X = minX};
if (Y < minY) {dY = -dY; Y = minY};
if (X > maxX) {dX = -dX; X = maxX};
if (Y > maxY) {dY = -dY; Y = maxY};
drawBall(X-7,Y-7);
dX = (dX + mouseX - X)*0.98;
dY = (dY + mouseY - Y)*0.98;
if (NN) {setTimeout('moveBall()',4)};
}
}

function drawBall(left,top) {
eval(layerRef+'["ball"]'+styleSwitch+'.left=' + left);
eval(layerRef+'["ball"]'+styleSwitch+'.top=' + top);
}
//-->
</script>

<style type="text/css">
A {text-decoration:none}
#ball {position: absolute; visibility: visible; top: -16; left: -16; z-index: 1;}
#body {position: absolute; visibility: visible; z-index: 0}
</style>

</head>

<!-- ============================================================== --
>
<body onload="init()"
bgcolor="#eeeeee" text="#000033" link="#000099" vlink="#000066" alink="#990000">

<div id="ball">
<script type="text/javascript" language="JavaScript">
<!--
if (NN || IE)
{document.write('<img src="ball.gif" height=14 width=14 alt="">')}
//-->
</script>
</div>

<div id="body">
...
</div>

</body>

</html>



Unobtrusive javascript for maintaining scrollable layer state
Categories : DHTML, Java Script, HTML
This is a script that list all image files on a given directory, and displays the thumbnails nicely formated within an HTML table. It also make use of JavScript to open pop up windows when the users want to see the full photo.
Categories : Graphics, PHP, Complete Programs, Java Script
KuPro1.0 - This application is for Libraries, To see their books and to maintain users books. This version is in Turkish, future vers may have English Support.
Categories : PHP, Java Script, DHTML
Random Image
Categories : Java Script, Graphics
Menu in sliding bar or tree style. Handles frames by using small amount of javascript. Handles external and internal pages. Allows custom code to replace a menu item.
Categories : PHP Classes, PHP, Java Script, DHTML
Javascript animated menu items
Categories : DHTML, CSS, Java Script, HTML
JAVASCRIPT interface class to the eBusiness Charts generatation remote service.
Categories : Java Script, Graphics, Charts and Graphs
JavaScript Fade In Text Messages
Categories : Java Script, DHTML
Simple Dhtml tree using DOM
Categories : DHTML, Java Script
crop and resize image class using gd library function
Categories : PHP, PHP Classes, GD image library, Graphics
javascript doesn't accept a fieldname with []
Categories : Java Script
PHP4 session helper HTML file.
Categories : PHP, Java Script, HTML and PHP, Sessions
Install Flash player plug-in
Categories : Flash, Java Script
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
Dynamic Calender in PHP, Javascript and HTML.
Categories : PHP, Java Script, HTML and PHP, Calendar