Archive for the Category »javascript «

Every liked the swatch @beat time for an internation new time ?

What looks like that:

The current Internet Beat time is @772.

can be realised by a javascript like that:

<html>

<SCRIPT>
<!--
function getBeat()
{
	var now = new Date();
	var off = (now.getTimezoneOffset() + 60)*60;
	var theSeconds = (now.getHours() * 3600) + (now.getMinutes() * 60) + now.getSeconds() + off;
	var beat = Math.floor(theSeconds/86.4);
	if (beat > 1000) beat -= 1000;
	if (beat < 0) beat += 1000;
	return beat;
}

// I added a little function that keeps updating the beat time

function follow()
{
	if (!document.getElementById || window.opera) return;
	document.getElementById('writeroot').innerHTML = '@' + getBeat();
	setTimeout('follow()',20000);
}
// -->
</SCRIPT>

<body>
<P>The current Internet Beat time is <SPAN ID="writeroot"><SCRIPT>document.write('@'+getBeat())</SCRIPT></SPAN>.</P>

</body>
</html>

vkeyboardHi, thanks to Keith Wood , creator from this cool virtuale keyboard
http://keith-wood.name/keypad.html

I had some problems with it and needed a working back button and also that i just simple can keep my forms in Frame1 as they are and a virtual keyboard in the second frame.
Wohhh and he really did it great.

Download the Demo

iwebkitsHi, while is was searching for a simple solution to create a homepage that looks like the GUi of Iphone I found IWebKit. It works great, just the sliding did not worked. Here Marcus from devilx.net helped me out and did a frame work that adds the Sliding into the iWebkit.

So here you find the original Framework with the examples:
http://iwebkit.net/

Than just download the hacked Framework with sliding and replace the css and js

http://www.devilx.net/2009/09/08/hacked-iwebkit-a-bit/

Enjoy

Greets

Chris

Somtimes you may like to pause your javascript for a while (milliseconds). Here is a simple script i found from sean.co.uk that do exactly this:

<script language=”javascript”>

// www.sean.co.uk

function pausecomp(millis) 
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);

</script>

When you need to jump to a specific URL direct after you choosed a Statement from a Selectbox:

 

<select onchange=”window.open(this.options[this.selectedIndex].value,’_self’)”>

    <option value=”">Choose a Language…</option>

    <option value=”database.php?lang=en”>English</option>

    <option value=”database.php?lang=de”>Deutsch</option>

    <option value=”database.php?lang=id”>Italian</option>

    <option value=”database.php?lang=ru”>Russian</option>

</select>