: DinkostaOnline - Miscellaneous scripts :
 You are here : Web design > JavaScript > Miscellaneous scriptsDinkostaOnline 
Top links

HTML intro

CSS intro

Batch files

Introduction to JavaScript

Webmasterstuff

Speed-up&search the Internet

The Registry

Security on the Internet

About Pirot
Miscellaneous scripts
  Scripts that didn't fit into the other categories, I've decided to label Miscellenous scripts and to devide them into two parts.
 In the first part of these scripts you can see an example of a date and time in titlebar script and the appropriate code if you want to use it for your site. The second topic is about dynamic web pages with external JavaScript files.
 In the second part you can see an example of a very simple calculator and examples of using ASCII code in JavaScript. Every example is with the appropriate code to cut and paste it onto your site or use it for some other purpose.

 Next 

Here is a simple script that demonstrates how to create animation and move objects with JavaScript.
<script>
function mov(){
if(ani.style.pixelLeft<1000)
ani.style.pixelLeft+=5
ro=setTimeout("mov()",50)}
function naz(){
clearTimeout(ro)
ani.style.pixelLeft=0}
</script>

Put the animation object and the buttons into the body of the document:
<body><div id=ani style="position:relative"><img src="avion.gif"></div><button onclick=mov()>Go</button><button onclick=naz()>Come back</button>
 
To get vertical movement use pixelTop instead of pixelLeft and to change the speed of the animation increase or decrease the value in the third line (+=5). Putting a minus sign instead of the plus sign in front of this value will change the direction.

1
Hosted by www.Geocities.ws