Thursday, 24 February 2011

Javascript count


<html>
<head>
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;

function timedCount()
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout("timedCount()",1000);
}

function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}
</script>
</head>

<body>
<form>
<input type="button" value="Start count!" onClick="doTimer()">
<input type="text" id="txt">
</form>
<p>Click on the button above. The input field will count forever, starting at 0.</p>
</body>
</html>

Javascript button


<html>
<head>
<script type="text/javascript">
function show_confirm()
{
var r=confirm("Press a button!");
if (r==true)
{
alert("You pressed OK!");
}
else
{
alert("You pressed Cancel!");
}
}
</script>
</head>
<body>

<input type="button" onclick="show_confirm()" value="Show a confirm box" />

</body>
</html>

javascript Basic


<html>
<body>

<script type="text/javascript">
document.write("This is my first JavaScript!");
</script>

</body>
</html>

javascript hello!


<html>
<head>
<script type="text/javascript">
function displaymessage()
{
alert("Hello World!");
}
</script>
</head>

<body>
<form>
<input type="button" value="Click me!" onclick="displaymessage()" />
</form>

<p>By pressing the button above, a function will be called. The function will alert a message.</p>

</body>
</html>

javascript clock


<html>
<head>
<script type="text/javascript">
function timedMsg()
{
var t=setTimeout("alert('I am displayed after 3 seconds!')",3000);
}
</script>
</head>

<body>
<form>
<input type="button" value="Display alert box!" onClick="timedMsg()" />
</form>
</body>

</html>

greeting script


<script language="JavaScript">
<!--
var name=prompt("Enter Your Name, Please.","name");
var today = new Date ()
var hrs = today.getHours();
document.writeln("<b>");
document.writeln("<b>");
if (hrs <= 12)
document.write("Good Morning "+name+'!');
else if (hrs <= 18)
document.write("Good Afternoon "+name+'!');
else
document.write("Good Evening "+name+'!'); document.writeln("<br />");
// -->
</script>

Wednesday, 16 February 2011

google search

<center><FORM method=GET action="http://www.google.com/search">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="http://www.google.com/">
<IMG SRC="http://www.google.com/logos/Logo_40wht.gif" <br></A>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT TYPE=hidden name=hl value="en">
<INPUT type=submit name=btnG VALUE="Google Search">
</td></tr></TABLE>
</FORM>
</center>
<!-- Search Google -->

<font face="Tahoma"><a target="_blank" href="http://www.javascriptfreecode.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>

3-way image slide show

<TABLE
border="0" cellspacing="0" cellpadding="0"> <TR> <TD>
<form name="Oneslideform" > <DIV align="center"> <TABLE
width="150" border="1" cellspacing="0" cellpadding="4"
bordercolor="#330099"> <TR> <TD bgcolor="#330099">
<DIV align="center"><B><FONT color="#FFFFFF">Image
Slideshow</FONT></B></DIV> </TD> </TR>
<TR> <TD bgcolor="#FFFFFF"> <DIV align="center"><A
href="javascript:Onetransport()"><IMG src="image01.jpg"
width="200" height="150" name="Oneshow"
border="0"></A></DIV> </TD> </TR> <TR>
<TD bgcolor="#330099"> <DIV align="center"> <SELECT
name="Oneslide" onChange="Onechange();"> <OPTION
value="image01.jpg" selected>Image 1</OPTION> <OPTION
value="image02.jpg">Image 2</OPTION> <OPTION
value="image03.jpg">Image 3</OPTION> </SELECT>
</DIV> </TD> </TR> <TR> <TD
bgcolor="#330099"> <DIV align="center"> <INPUT type=button
onClick="Oneprevious();" value="<<" title="Previous">
<INPUT type=button name="Oneslidebutton"
onClick="Oneap(this.value);" value="Start" title="AutoPlay">
<INPUT type=button onClick="Onenext();" value=">>"
title="Next"> </DIV> </TD> </TR> </TABLE>
</DIV> </form> </TD> </TR>
</TABLE>