Monday, August 27, 2012

Displaying Dynamic Clock on the Website


<head>
<!--Simply copy and paste it where you wish it to appear.-->

<script language="Javascript1.2">
<!--
//Visit http://myhtmlquestionbank.blogspot.com for this script

if(navigator.appName == "Netscape") {
document.write('<layer id="clock"></layer><br>');
}

if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<span id="clock"></span><br>');
}

function upclock(){
var dte = new Date();
var hrs = dte.getHours();
var min = dte.getMinutes();
var sec = dte.getSeconds();
var col = ":";
var spc = " ";
var apm;

if (12 < hrs) {
apm="PM";
hrs-=12;
}

else {
apm="AM";
}

if (hrs == 0) hrs=12;
if (min<=9) min="0"+min;
if (sec<=9) sec="0"+sec;

if(navigator.appName == "Netscape") {
document.clock.document.write(hrs+col+min+col+sec+spc+apm);
document.clock.document.close();
}

if (navigator.appVersion.indexOf("MSIE") != -1){
clock.innerHTML = hrs+col+min+col+sec+spc+apm;
}
}

setInterval("upclock()",1000);
//-->
</script>

<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://myjavaquestionbank.blogspot.in">Techno Inida</a></font></p>



   <style type="text/css"><!--
     body {scrollbar-3dlight-color:;
                scrollbar-arrow-color:;
                scrollbar-track-color: ;
                scrollbar-darkshadow-color:;
                scrollbar-face-color:;
                scrollbar-highlight-color:;
                scrollbar-shadow-color:}
   --></style>

  </head>

Displaying Clock on Status Bar



<!--Place this script in the HEAD section.-->


<SCRIPT LANGUAGE="JavaScript" type="text/javascript">

   <!-- hide the script from old browsers --
//Visit http://rainbow.arch.scriptmania.com for this script and more
   function doClock() {
     window.setTimeout( "doClock()", 1000 );
     today = new Date();
     self.status = today.toString();
   }
   //--end hiding here -->
   </script>

<!--Insert this in the BODY tag-->

    <Body   onLoad="doClock()" >

Saturday, August 25, 2012

input type checkbox HTML5, input type radio HTML5.


input type checkbox HTML5,  input type radio HTML5.

Introduction:
In this tutorial, you will the use of  checkbox and radio type input field. If type is checkbox then user can select multiple checkbox. If type is radio then user can select any one at a time.
Type Attribute:
AttributeValueDescription
typecheckbox
radio
user can select multiple checkbox.
at time only one.
Declaration Syntax :
                           <input  type="password" attribute/>

Example of <input> in HTML5:

Code:
TypePassword_Tag.html
<!DOCTYPE html >
<html >
<head>
<title>Password field</title>
</head>
<body>
<form>
<h2>Input tag.</h2>
<h2>Implementation of&nbsp; password type input tag. </h2>
<table><tr>
<td style="width: 198px">passord</td>
<td><input type="password" ></td>
</tr>
</table>
</form>
</body>
</html>
Output:

Tuesday, August 14, 2012

Employee registration Using JAVA SCRIPT


HTML FORM :

<!DOCTYPE html>
<html lang="en"><head>
<meta charset="utf-8">
<title>JavaScript Form Validation using a sample registration form</title>
<meta name="keywords" content="example, JavaScript Form Validation, Sample registration form" />
<meta name="description" content="This document is an example of JavaScript Form Validation using a sample registration form. " />
<link rel='stylesheet' href='js-form-validation.css' type='text/css' />
<script src="sample-registration-form-validation.js"></script>
</head>
<body onload="document.registration.userid.focus();">
<h1>Registration Form</h1>
<p>Use tab keys to move from one input field to the next.</p>
<form name='registration' onSubmit="return formValidation();">
<ul>
<li><label for="userid">User id:</label></li>
<li><input type="text" name="userid" size="12" /></li>
<li><label for="passid">Password:</label></li>
<li><input type="password" name="passid" size="12" /></li>
<li><label for="username">Name:</label></li>
<li><input type="text" name="username" size="50" /></li>
<li><label for="address">Address:</label></li>
<li><input type="text" name="address" size="50" /></li>
<li><label for="country">Country:</label></li>
<li><select name="country">
<option selected="" value="Default">(Please select a country)</option>
<option value="AF">Australia</option>
<option value="AL">Canada</option>
<option value="DZ">India</option>
<option value="AS">Russia</option>
<option value="AD">USA</option>
</select></li>
<li><label for="zip">ZIP Code:</label></li>
<li><input type="text" name="zip" /></li>
<li><label for="email">Email:</label></li>
<li><input type="text" name="email" size="50" /></li>
<li><label id="gender">Sex:</label></li>
<li><input type="radio" name="msex" value="Male" /><span>Male</span></li>
<li><input type="radio" name="fsex" value="Female" /><span>Female</span></li>
<li><label>Language:</label></li>
<li><input type="checkbox" name="en" value="en" checked /><span>English</span></li>
<li><input type="checkbox" name="nonen" value="noen" /><span>Non English</span></li>
<li><label for="desc">About:</label></li>
<li><textarea name="desc" id="desc"></textarea></li>
<li><input type="submit" name="submit" value="Submit" /></li>
</ul>
</form>
</body>
</html>


JAVA SCIPRT VALIDATION :


function formValidation()
{
var uid = document.registration.userid;
var passid = document.registration.passid;
var uname = document.registration.username;
var uadd = document.registration.address;
var ucountry = document.registration.country;
var uzip = document.registration.zip;
var uemail = document.registration.email;
var umsex = document.registration.msex;
var ufsex = document.registration.fsex; if(userid_validation(uid,5,12))
{
if(passid_validation(passid,7,12))
{
if(allLetter(uname))
{
if(alphanumeric(uadd))
{
if(countryselect(ucountry))
{
if(allnumeric(uzip))
{
if(ValidateEmail(uemail))
{
if(validsex(umsex,ufsex))
{
}
}
}
}
}
}
}
}
return false;

} function userid_validation(uid,mx,my)
{
var uid_len = uid.value.length;
if (uid_len == 0 || uid_len >= my || uid_len < mx)
{
alert("User Id should not be empty / length be between "+mx+" to "+my);
uid.focus();
return false;
}
return true;
}
function passid_validation(passid,mx,my)
{
var passid_len = passid.value.length;
if (passid_len == 0 ||passid_len >= my || passid_len < mx)
{
alert("Password should not be empty / length be between "+mx+" to "+my);
passid.focus();
return false;
}
return true;
}
function allLetter(uname)
{
var letters = /^[A-Za-z]+$/;
if(uname.value.match(letters))
{
return true;
}
else
{
alert('Username must have alphabet characters only');
uname.focus();
return false;
}
}
function alphanumeric(uadd)
{
var letters = /^[0-9a-zA-Z]+$/;
if(uadd.value.match(letters))
{
return true;
}
else
{
alert('User address must have alphanumeric characters only');
uadd.focus();
return false;
}
}
function countryselect(ucountry)
{
if(ucountry.value == "Default")
{
alert('Select your country from the list');
ucountry.focus();
return false;
}
else
{
return true;
}
}
function allnumeric(uzip)
{
var numbers = /^[0-9]+$/;
if(uzip.value.match(numbers))
{
return true;
}
else
{
alert('ZIP code must have numeric characters only');
uzip.focus();
return false;
}
}
function ValidateEmail(uemail)
{
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(uemail.value.match(mailformat))
{
return true;
}
else
{
alert("You have entered an invalid email address!");
uemail.focus();
return false;
}
} function validsex(umsex,ufsex)
{
x=0;

if(umsex.checked)
{
x++;
} if(ufsex.checked)
{
x++;
}
if(x==0)
{
alert('Select Male/Female');
umsex.focus();
return false;
}
else
{
alert('Form Succesfully Submitted');
window.location.reload()
return true;
}
}

Saturday, August 4, 2012

Date Picker for Text box in HTML



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Calendar javascript Code</title>
<link rel="stylesheet" type="text/css" href="http://www.jscodes.com/codes/calendar_javascript/demo/css/datePicker.css" />
<script src="C:\richa_674899\MAS group6\ui for news and events\calender\jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="http://www.jscodes.com/codes/calendar_javascript/demo/js/jquery.datePicker-min.js" type="text/javascript"></script>
<!--[if IE]><script type="text/javascript" src="http://www.jscodes.com/codes/calendar_javascript/demo/js/jquery.bgiframe.min.js"></script><![endif]-->

<script type="text/javascript">
  $(window).ready(function(){
  $('#date-pick').datePicker({clickInput:true});
});
</script>


</head>
<body>
<p><label>Please choose: </label><input type="text"  name="it" id="date-pick" /></p>
</body>
</html>









======
Css file ::
======
.clear{
clear:both;
}
.it,.so,.is{
border:1px solid #ccc;
vertical-align:middle;}

/* Date Picker  */
table.jCalendar {
border: 1px solid #fff;
border-collapse:collapse;
font-family:Tahoma;
}


table.jCalendar th {
background: #333;
color: #fff;
font-weight: normal;
padding: 3px 5px;
vertical-align:middle;
}

table.jCalendar td {
background: #AADBF9;
color: #000;
font-size:11px;
border:1px solid #fff;
padding: 3px 5px;
text-align: center;
}
table.jCalendar td.other-month {
background: #D0E6F7;
color: #555;
}
table.jCalendar td.today {
background: #FF6600;
color: #fff;
}
table.jCalendar td.selected {
background: #f66;
color: #fff;
}
table.jCalendar td.selected.dp-hover {
background: #fff;
color: #f66;
}
table.jCalendar td.dp-hover,
table.jCalendar tr.activeWeekHover td {
background: #fff;
color: #000;
}
table.jCalendar tr.selectedWeek td {
background: #f66;
color: #fff;
}
table.jCalendar td.disabled, table.jCalendar td.disabled.dp-hover {
background: #ECF1F4;
color: #888;
}
table.jCalendar td.unselectable,
table.jCalendar td.unselectable:hover,
table.jCalendar td.unselectable.dp-hover {
background: #fff;
color: #555;
}

/* For the popup */

/* NOTE - you will probably want to style a.dp-choose-date - see how I did it in demo.css */


div.dp-popup {
position: relative;
background: #D6E9F8;
font-size: 12px;
font-family: arial, sans-serif;
padding: 2px;

width: 162px ;
width:162px\9;
line-height: 1.2em;
font-family:Tahoma;


}

@media screen and (-webkit-min-device-pixel-ratio:0) { div.dp-popup { width: 175px ; } }

div#dp-popup {
position: absolute;
z-index: 199;
}
div.dp-popup h2 {
font-size: 12px;
text-align: center;
margin: 2px 0;
padding: 0;
}
a#dp-close {
font-size: 11px;
padding: 4px 0;
text-align: center;
display: block;
}
a#dp-close:hover {
text-decoration: underline;
}
div.dp-popup a {
color: #000;
text-decoration: none;
padding: 3px 4px 0;
}
div.dp-popup div.dp-nav-prev {
position: absolute;
top: 2px;
left: 0px;
width: 80px;
}
div.dp-popup div.dp-nav-prev a {
float: left;
}
/* Opera needs the rules to be this specific otherwise it doesn't change the cursor back to pointer after you have disabled and re-enabled a link */
div.dp-popup div.dp-nav-prev a, div.dp-popup div.dp-nav-next a {
cursor: pointer;
}
div.dp-popup div.dp-nav-prev a.disabled, div.dp-popup div.dp-nav-next a.disabled {
cursor: default;
}
div.dp-popup div.dp-nav-next {
position: absolute;
top: 2px;
right: 0px;
width: 80px;
}
div.dp-popup div.dp-nav-next a {
float: right;
}
div.dp-popup a.disabled {
cursor: default;
color: #aaa;
}
div.dp-popup td {
cursor: pointer;
}
div.dp-popup td.disabled {
cursor: default;
}



==========
Java Script File  ::
=============