Sonntag, 29. März 2009

javascript alert box

EE4216/EE5806 Internet Client-Server computing

The use of javascript alert box.

function formSubmit()
{
window.event.returnValue =false;
// To find out which radio button is selected

var com;
if (myform.Command[0].checked)
com = "Search";
else if (myform.Command[1].checked)
com = "Update";
else if (myform.Command[2].checked)
com = "Delete";
//document.write(" Command is : " + com);

while ( window.event.returnValue !=true)
{
switch (com)
{
case "Search":
if (myform.Lastname.value.length == 0)
{
window.alert("Search Command : \nLast name is
Missing! ");
return;
}
else
window.event.returnValue =true;
break;

case "Update":
if (myform.Lastname.value.length == 0)
{
window.alert("Update Command: \nLast name is missing! Please Fill in!");
return;
}
else if (myform.Firstname.value.length == 0)
{
window.alert("Update Command : \nFirst Name name is missing! Retry!! ");
return;
}
else if (myform.PhoneNum.value.length == 0)
{
window.alert("Update Command : \nPhone Number is missing! Try again!! ");
return;
}
else
window.event.returnValue =true;
break;

case "Delete":
if (myform.Lastname.value.length == 0)
{
window.alert("Delete Command :\n Last name is Missing! ");
return;
}
else if (myform.Firstname.value.length == 0)
{
window.alert("Delete Command :\n First Name name is missing! Retry!! ");
return;
}
else
window.event.returnValue =true;
break;
default:
break;
}
} // while
}






Keine Kommentare: