java
************************************************************
************************************************************
Q1.print hello word using java script
<html>
<head>
<title>:: Que-1 ::</title>
</head>
<body>
<script language="javascript">
document.write("hello world");
</script>
</body>
</html>
************************************************************
Q.2.appy all arithmatic opretion
<html>
<head>
<title>:: Que-2 ::</title>
</head>
<body>
<script language="javascript">
var x=23;
y=40;
document.write("x="+x+"<br>");
document.write("y="+y+"<br>");
document.write("x+y="+(x+y)+"<br>");
document.write("x-y="+(x-y)+"<br>");
document.write("x*y="+(x*y)+"<br>");
document.write("x/y="+(x/y)+"<br>");
document.write("x%y="+(x%y)+"<br>");
x++;
y--;
document.write("x++="+(x)+"<br>");
document.write("y++="+(y)+"<br>");
</script>
</body>
</html>
****************************************************************
Que.3.find number is even or odd
<html>
<head>
<title>:: Question-3 ::</title>
</head>
<body>
<script language="javascript">
var a=2;
if(a%2==0)
{
document.write("this is enen number");
}
else
{
document.write("tihs is odd mumber");
}
</script>
</body>
</html>
**************************************************************
Q.4.take defalut marks and find the greade using if else ledder and switch case.
above 80 a+
70to 80 a
60 to 70 b
50 to 60 c
below 50 fail.
<html>
<head>
<title>:: Question ::</title>
</head>
<body><font size="7">
<script language="javascript">
var a=80;
if(a>80)
{
document.write("a+");
}
else if(a>70)
{
document.write("a");
}
else if(a>60)
{
document.write("b");
}
else if(a>50)
{
document.write("c");
}
else
{
document.write("fail");
}
</script>
</font>
</body>
</html>
***************************************************************
Que5.using while loop print al even number between 1 to 25.
<html>
<head>
<title>:: Question-5 ::</title>
</head>
<script language="javascript">
var a=1,sum=0;
while(a<=25)
{
if(a%2==0)
{
document.write(a + " ");
}
a++;
}
</script>
</body>
</html>
***************************************************************
Que6.using for loop print multiplication table.
<html>
<head>
<title>:: Question-6 ::</title>
<script language="javascript">
no=5;
for (i=1; i<=10; i++)
{
document.write(no+"*"+ i +"="+(no*i)+"<br>");
}
</script>
</head>
</html>
*****************************************************************
Que.7.simple function and using parameter,using parameter with return value
with return value.
<html>
<head>
<script text="text/Javascript">
<!--
function concatenate(first,last)
{
var full;
full=first+last;
return full;
}
//-->
function secondFunction()
{
var result;
result = concatenate('Zara', 'Ali');
alert(result );
}
</script>
</head>
<body>
<p>Click the following button to call the function</p>
<form>
<input type="button" onclick="secondFunction()" value="Call Function">
</form>
</body>
</html>
*****************************************************************
using parameter.
Q.7 a
<html>
<head>
<title>:: Qusestion-7 ::</title>
<script language="javascript">
function sayhello(name,age)
{
alert(name+ "is" +age+"year old");
}
</script>
</head>
<body>
<p>click the following button to call function</p>
<form>
<input type="button" onclick="sayhello('zara',7)" value="say hello">
</form>
</body>
</html>
***************************************************************
Que.8.apply all dialog box.
1.allert
2.comform
3.prompt
1.allert--:
<html>
<head>
<title>My Javascript Page</title>
</head>
<body>
<script type="text/javascript">
alert("Welcome to my world!!!");
</script>
</body>
</html>
2.confirm--
<html>
<head>
<title>My Javascript Page</title>
</head>
<body>
<script>
if (confirm("Do you agree"))
{alert("You agree")}
else{alert ("You do not agree")};
</script>
</body>
</html>
3.prompt--
<html>
<head>
<title>My Javascript Page</title>
</head>
<body>
<script>
username=prompt("Please enter your name","Enter your name here");
document.write(username);
</script>
</body>
</html>
*****************************************************************
Que.9.apply on click,mouse over,mouse out event.
onclick--
<html>
<head>
<title>vishal patel</title>
</head>
<body>
<form align="center">
<select name="vishal">
<option value="http://www.google.com">google</option>
<option value="http://www.yahoo.com">yahoo</option>
<option value="http://www.bing.com">bing</option>
</select>
<input type="button" value="go" onclick=window.open(vishal.value)>
</form>
</body>
</html>
mouse over--
<html>
<head>
<title>::QUE-9::</title>
<script languge="javascript">
function over()
{
alert("mouse over");
}
function out()
{
alert("mouse out");
}
</script>
</head>
<body>
<div onmouseover="over()" onmouseout ="out">
<h2>this is inside the division</h2>
</div>
</body>
</html>
mouse out---
Q 9) Apply on click mouse over mouse out cerate.
<html>
<head>
<title>question=9</title>
<script type="text/javascript">
<!--
function over(){
alert("mouse over");
}
function out(){
alert("mouse out");
}
//-->
</script>
</head>
<body>
<p>bring your mouse inside the division to see the result=</p>
<div onmouseover ="over()" onmouseout="out()">
<h1> hello mem </h1>
</div>
</body>
</html>
**************************************************************
Que.10.find simple interest.
<html>
<head>
<title>question=10</title>
<script language="Javascript">
function simple()
{
var p,r,n,i;
if(document.intrest.principle.value=="")
{
alert("please enter principle amount");
document.intrest.principle.focus();
}
else if(document.intrest.rate.value=="")
{
alert("please enter rate");
document.intrest.rate.focus();
}
else if(document.intrest.year.value=="")
{
alert("please enter year");
document.intrest.year.focus();
}
else
{
p=parseInt(document.intrest.principle.value);
r=parsefloat(document.intrest.rate.value);
n=parsefloat(document.intrest.year.value);
i=(p*r*n)/100;
document.intrest.answer.value="Rs."+i;
}
}
</script>
</head>
<body>
<form method="post" name="intrest">
<h1 align="center">simple interest </h1>
<table border="1" align="center">
<tr>
<td>enter principal amount: </td>
<td>
<input type="text" name="principle" />
</td>
</tr>
<tr>
<td>enter rate of intrest:</td>
<td><input type="text" name="rate" size="7" />
</td>
</tr>
<tr>
<td>enter no of years:</td>
<td><input type="text" name="year" size="7" />
</td>
</tr>
<tr>
<td>answer:</td>
<td><input type="text" name="answer" size="7" />
</td>
</tr>
<tr>
<td><input type="button" value="calculate" onclick="simple()" />
</td>
<td><input type="button" value="reset" /></td>
</tr>
</table>
</form>
</body>
</html>
****************************************************************
Que.11 wap for calculator
<html>
<head>
<title>calculator</title>
</head>
<body>
<h1 align="center">calculator</h1>
<form name="calc">
<table border=4 align="center" bgcolor="grey">
<tr>
<td>
<input type="text" name="input" size="16">
<br>
</td>
</tr>
<tr>
<td>
<input type="button" name="one" value=" 1 " onclick="calc.input.value+= '1'">
<input type="button" name="two" value=" 2 " onclick="calc.input.value+= '2'">
<input type="button" name="three" value=" 3 " onclick="calc.input.value+= '3'">
<input type="button" name="plus" value=" + " onclick="calc.input.value+= '+'">
<br>
<input type="button" name="four" value=" 4 " onclick="calc.input.value+= '4'">
<input type="button" name="five" value=" 5 " onclick="calc.input.value+= '5'">
<input type="button" name="six" value=" 6 " onclick="calc.input.value+= '6'">
<input type="button" name="minus" value=" - " onclick="calc.input.value+= '-'">
<br>
<input type="button" name="seven" value=" 7 " onclick="calc.input.value+= '7'">
<input type="button" name="eight" value=" 8 " onclick="calc.input.value+= '8'">
<input type="button" name="nine" value=" 9 " onclick="calc.input.value+= '9'">
<input type="button" name="times" value=" X " onclick="calc.input.value+= '*'">
<br>
<input type="reset" name="clear" value=" c " onclick="calc.input.value+= ''">
<input type="button" name="zero" value=" 0 " onclick="calc.input.value+= '0'">
<input type="button" name="dolt" value=" = " onclick="calc.input.value= eval(calc.input.value)">
<input type="button" name="div" value=" / " onclick="calc.input.value+= '/'">
<br>
</td>
</tr>
<tr>
<td align="center"><marquee><font color="white">
VISHAL</font></marquee>
</td>
</tr>
</table>
</form>
</body>
</html>
****************************************************************
Q.12 wap for find percentage and average application.
<html>
<head>
<title>vishal</title>
<script type="text/javascript">
function validate()
{
var no1,no2,no3,no4,no5,avg,total;
if( document.myForm.r1.value == "" )
{
alert( "Please provide your rollno!" );
document.myForm.r1.focus() ;
return false;
}
else if( document.myForm.n1.value == "" )
{
alert( "Please provide your name!" );
document.myForm.n1.focus() ;
}
else if( document.myForm.g1.value == "-1" )
{
alert( "Please provide your class!" );
}
else if( document.myForm.m1.value == "" )
{
alert( "Please provide your marks1!" );
document.myForm.m1.focus() ;
}
else if( document.myForm.m2.value == "" )
{
alert( "Please provide your marks2!" );
document.myForm.m2.focus() ;
}
else if( document.myForm.m3.value == "" )
{
alert( "Please provide your marks3!" );
document.myForm.m3.focus() ;
}
else if( document.myForm.m4.value == "" )
{
alert( "Please provide your marks4!" );
document.myForm.m4.focus() ;
}
else if( document.myForm.m5.value == "" )
{
alert( "Please provide your marks5!" );
document.myForm.m5.focus() ;
}
else
{
m1=parseInt(document.myForm.m1.value);
m2=parseInt(document.myForm.m2.value);
m3=parseInt(document.myForm.m3.value);
m4=parseInt(document.myForm.m4.value);
m5=parseInt(document.myForm.m5.value);
total=(m1+m2+m3+m4+m5);
avg=total/5.0;
document.myForm.t1.value=total;
document.myForm.a1.value=avg;
}
}
</script>
</head>
<body>
<h1 align="center">Regestration</h1>
<form name="myForm">
<table border="1" align="center">
<tr>
<td colspan="2">
<marquee bgcolor="yellow" text="red"><font color="red">Please fill up the All Details</font></marquee>
</td>
</tr>
<tr>
<td>
ROLL NO:
</td>
<td>
<input type="text" color="grey" name="r1">
</td>
</tr>
<tr>
<td>
NAME:</td>
<td>
<input type="text" name="n1"></td>
<tr>
<td>
GENDER:</td>
<td>MALE:
<input type="radio" name="gender" checked>
FEMALE:
<input type="radio" name="gender">
</td>
</tr>
<tr>
<td>
DIV:</td><td>
<select name="g1">
<option value="-1">--Select</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3"> C</option>
</td>
</tr>
<tr>
<td valign="center">
SUBJECT:</td>
<td>
<table border=1>
<tr>
<td>
FOP</td>
<td>
<input type="text" name="m1"></td>
</tr>
<tr>
<td>
FCO</td>
<td>
<input type="text" name="m2"></td>
</tr>
<tr>
<td>
IWD</td>
<td>
<input type="text" name="m3"></td>
</tr>
<tr>
<td>
DBMS</td>
<td>
<input type="text" name="m4"></td></tr>
<tr>
<td>
S.L</td>
<td>
<input type="text" name="m5"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
TOTAL:</td><td>
<input type="text" name="t1"></td></tr>
<tr><td>
AVERAGE:</td><td>
<input type="text" name="a1"></td></tr>
<tr align="center">
<td align="center" colspan="2">
<input type="button" value="SUBMIT" onclick="validate();">
<input type="reset">
</td>
</tr>
</table>
</form>
</marquee>
</body>
</html>
*****************************************************************
*****************************************************************
css Assighnment
*****************************************************************
*****************************************************************
Que.1 use css in fonts tag.
<html>
<head>
<style type="text"/css>
p
{
font-size:500;
font-family:arial;
color:red
font-weight:bold;
}
</style>
</head>
<body>
<h1>vishal</h1>
<p> hello i am vishal patel</p>
</body>
</html>
**************************************************************
Que.2 inline css with back ground css effects.
<html>
<head>
<title>2nd demo
<-*************inline css***********->
</title>
</head>
<body>
<h1 style="color:red;">
this is example of inline css
</h1>
</body>
</html>
******************************************************************
Que-3.change bgcolor using css.
<html>
<head>
<title>3rd demo</title>
<style type="text/css">
body
{
background-color:yellow;
}
</style>
<body>
</body>
</head>
</html>
******************************************************************
Que-4.bg image from css.
<html>
<head>
<title>background image</title>
<style type="text/css" media=all>
body
{
background-image:url("img8.jpg");
background-repeat:no-repeat;
background-attachment:scroll;
}
</style>
</head>
<body>
hello world
<p>
A computer is a device that accepts information
(in the form of digitalized data)
and manipulates it for some result
based on a program or sequence of
instructions on how the data is to
be processed. Complex computers also
include the means for storing data (including the)</p>
</body>
</html>
***********************************************************
Que-5.bg image with no repeate
<html>
<head>
<title>background image</title>
<style type="text/css" media=all>
body
{
background-image:url("img8.jpg");
background-repeat:no-repeat;
background-attachment:scroll;
}
</style>
</head>
<body>
hello world
<p>
A computer is a device that accepts information
(in the form of digitalized data) and manipulates
it for some result based on a program or sequence
of instructions on how the data is to be processed.
Complex computers also include the means for storing data
(including the)</p>
</body>
</html>
**********************************************************
Que.6.change head tag color using css.
<html>
<htead>
<title>css.1</title>
<style type="text/css">
h1
{
color:red;
}
</style>
</head>
<body>
<h1>hello this is first css </h1>
</body>
</html>
****************************************************************
Que.8.
<html>
<htead>
<title>css.1</title>
<style type="text/css">
h1
{
color:red;
}
body
{
background-image:url("img8.jpg");
}
</style>
</head>
<body>
<h1>hello this is first css </h1>
</body>
</html>
*************************************************************
Que.9.bg image with head tag and no repeate bg image.
<html>
<htead>
<title>css.1</title>
<style type="text/css">
h1
{
color:red;
}
body
{
background-image:url("img8.jpg");
background-repeat:no-repeat;
}
</style>
</head>
<body>
<h1>hello this is first css </h1>
</body>
</html>
****************************************************************
Que.10.repet y bg image.
<html>
<htead>
<title>css.1</title>
<style type="text/css">
h1
{
color:red;
}
body
{
background-image:url("img8.jpg");
background-repeat:repeat-y;
}
</style>
</head>
<body>
<h1>hello this is first css </h1>
</body>
</html>
****************************************************************
Que-11.fixed attechment css.
<html>
<htead>
<title>css.1</title>
<style type="text/css">
h1
{
color:red;
}
body
{
background-image:url("img8.jpg");
background-repeat:repeat-y;
background-attachment:fixed;
}
</style>
</head>
<body>
<h1>hello this is first css </h1>
*****************************************************************
Que-12 inline css
<html>
<head>
<title>inlinecss</title>
<head>
<body>
<h1 style="color:blue;"> hello this is a inline css </h1>
</body>
</html>
******************************************************************
Calculator
<HTML>
<BODY>
<br><br>
<CENTER><H3>A Simple Calculator</H3></CENTER><br>
<FORM NAME="Calc">
<TABLE BORDER=4 align="Center">
<TR>
<TD> <INPUT TYPE="text" NAME="AnsText" Size="22"> </TD>
</TR>
<TR>
<TD align="Center">
<INPUT TYPE="button" NAME="one" VALUE=" 1 " OnClick="Calc.AnsText.value += '1'">
<INPUT TYPE="button" NAME="two" VALUE=" 2 " OnCLick="Calc.AnsText.value += '2'">
<INPUT TYPE="button" NAME="three" VALUE=" 3 " OnClick="Calc.AnsText.value += '3'">
<INPUT TYPE="button" NAME="plus" VALUE=" + " OnClick="Calc.AnsText.value += ' + '">
<br>
<INPUT TYPE="button" NAME="four" VALUE=" 4 " OnClick="Calc.AnsText.value += '4'">
<INPUT TYPE="button" NAME="five" VALUE=" 5 " OnCLick="Calc.AnsText.value += '5'">
<INPUT TYPE="button" NAME="six" VALUE=" 6 " OnClick="Calc.AnsText.value += '6'">
<INPUT TYPE="button" NAME="minus" VALUE=" - " OnClick="Calc.AnsText.value += ' - '">
<br>
<INPUT TYPE="button" NAME="seven" VALUE=" 7 " OnClick="Calc.AnsText.value += '7'">
<INPUT TYPE="button" NAME="eight" VALUE=" 8 " OnCLick="Calc.AnsText.value += '8'">
<INPUT TYPE="button" NAME="nine" VALUE=" 9 " OnClick="Calc.AnsText.value += '9'">
<INPUT TYPE="button" NAME="times" VALUE=" * " OnClick="Calc.AnsText.value += ' * '">
<br>
<INPUT TYPE="button" NAME="clear" VALUE=" C " OnClick="Calc.AnsText.value = ''">
<INPUT TYPE="button" NAME="zero" VALUE=" 0 " OnClick="Calc.AnsText.value += '0'">
<INPUT TYPE="button" NAME="DoIt" VALUE=" = " OnClick="Calc.AnsText.value = eval(Calc.AnsText.value)">
<INPUT TYPE="button" NAME="div" VALUE=" / " OnClick="Calc.AnsText.value += ' / '">
<br>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
//////////////////////////////////////////////////////////////////////
Change case
<HTML>
<HEAD>
<TITLE> CHANGE CASE </TITLE>
<SCRIPT language="JavaScript">
function uppercase()
{
var m,a;
m=document.message.msg.value;
document.message.ans.value=(m.toUpperCase ());
}
function lowercase()
{
var m,a;
m=document.message.msg.value;
document.message.ans.value=(m.toLowerCase ());
}
</SCRIPT>
</HEAD>
<BODY>
<FONT size=+1>
<FORM name="message">
<BR> <BR> <BR>
Enter Your Message : <INPUT type="text" name="msg">
<BR> <BR> <BR>
Display :
<INPUT type="text" name="ans">
<BR> <BR> <BR>
<INPUT type="button" value="UPPERCASE" onClick="uppercase();">
<INPUT type="button" value="LOWERCASE" onClick="lowercase();">
<INPUT type="reset" value="clear">
</FORM>
</FONT>
</BODY>
</HTML>
0 comments:
Post a Comment