<html>
<head>
<title>Number in words</title>
<script language="javascript">
function convert()
{
var num=document.forms["frm1"].num.value;
document.forms["frm1"].words.value="";
if(isNaN(num))
{
alert("Not a Number");
}
else if (num<0 || num>999)
{
alert("Out of Range");
}
else
{
var len=num.length;
var words="";
for(var i=0;i<len;i++)
{
var n=num.substr(i,1);
switch(n)
{
case '0':words+="Zero ";break;
case '1':words+="One ";break;
case '2':words+="Two ";break;
case '3':words+="Three ";break;
case '4':words+="Four ";break;
case '5':words+="Five ";break;
case '6':words+="Six ";break;
case '7':words+="Seven ";break;
case '8':words+="Eight ";break;
default:words+="Nine ";
}
}
document.forms["frm1"].words.value=words;
}
}
</script>
</head>
<body>
<form name="frm1">
<center><h3>NUMBER IN WORDS</h3></center>
<br/>
<center>Enter a Number :<input type="text" name="num"</input><br/></center>
<br/>
<center><input type="button" name="inwords" value="In Words" onclick="convert()"></input></center>
<br/><br/><center>Number in Words :<input type="text" name="words"</input></center>
<br/>
</form>
</body>
</html>
1) Write an HTML page including JavaScript that takes a given set of integer numbers and shows them after sorting in descending order. View Solution
2) Write an HTML page including any required JavaScript that takes a number from one text field in the range of 0 to 999 and shows it in another text field in words. if the number is out of range, it should show “out of range” and if it is not a number, it should show “not a number” message in the result box. View Solution
3) Write an HTML page that has one input, which can take multi line text and a submit button. Once the user clicks the submit button, it should show the number of characters, words and lines in the text entered using an alert message. Words are separated with white space and lines are separated with new line character. View Solution
4) Write an HTML page that contains a selection box with a list of 5 countries. When the user selects a country, its capital should be printed next to the list. Add CSS to customize the properties of the font of the capital (color, bold and font size). View Solution
5) Create an XML document that contains 10 users information. Write a java program which takes users id as input and returns the users details by taking the user information from the XML document using DOM parser. View Solution
6) Create an XML document that contains 10 users information. Write a java program which takes users id as input and returns the users details by taking the user information from the XML document using SAX parser. View Solution
7) A user validation web application, where the user submits the login name and password to the server. The name and password are checked against the data already available in database and if the data matches, a successful login page is returned. Otherwise a failure message is shown to the user. View Solution
8) A user validation web application, where the user submits the login name and password to the server. The name and password are checked against the data already available in xml file (users.xml) and if the data matches, a successful login page is returned. Otherwise a failure message is shown to the user. View Solution
9) A user validation page web application, where the user submits the login name and password to the server. The name and password are checked against the data already available in database and if the data matches, a successful login Message is returned. Otherwise a failure message is shown to the user. Use AJAX to show the result on the same page below the button. View Solution
10) A simple calculator web application that takes two numbers and an operator (+,-,/,* and %)from an HTML page and returns the result page with the operation performed on the operands. View Solution
11) Modify the above program (Simple Calculator) such that it stores each query in a database and checks the database first for the result. If the query is already available in the DB, it returns the value that was previously computed (from DB) or it computes the result and returns it after storing the new query and result in DB. View Solution
12) A web application takes a name as input and on submit it shows a hellopage where is taken from the request. It shows the start time at the right top corner of the page and provides the logout button. On clicking this button, it should show a logout page with Thank You message with the duration of usage. (Use session to store name and time). View Solution
13) A web application that takes name and age from an HTML page. If the age is less than 18, it should send a page with “hello<name> you are not authorized to visit this site” message, where <name> should be replaced with the entered name. Otherwise it should send “Welcome <name> to this site “message. View Solution
14) A web application for implementation: The user is first served a login page which takes user’s name and password. After submitting the details the server checks these values against the data from a database and takes the following decisions. • If name and password matches serves a welcome page with user’s full name. • If name and password doesn’t match, then serves “password mismatch” page. • If name is not found in the database, serves a registration page, where user’s full name is asked and on submitting the full name, it stores, the login name, password and full name in the database (hint: use session for storing data, submitted login name and password). View Solution
15) A web application that lists all cookies stored in the browser on clicking “list Cookies ”button .Addcookies if necessary View Solution