Saturday 25 January 2014

if condition

<html>
<head>

<title>
Program on if statement
</title>
</head>
<body bgcolor=chocolate leftmargin=50 rightmargin=50>
<center>
<font color=blue size=6>
<h1 align=center>If statement example</h1>
<script language=javascript>
var x,y
x=prompt("Enter a value for X-Axis Coordinate")
y=prompt("Enter a value for Y-Axis Coordinate")
document.writeln("<br><br>"+"The given Coordinate ( "+x+" , "+y+" ) is on ")
if(x==0)
{
if(y==0)
{
document.writeln("Origin")
}
else
{
if(y>0)
{
document.writeln("Positive Y-Axis")
}
else
{
document.writeln("Negative Y-Axis")
}
}
}
else
{
if(x>0)
{
if(y==0)
{
document.writeln("Positive X-Axis")
}
else
{
if(y>0)
{
document.writeln("I-Quad")
}
else
{

document.writeln("IV-Quad")
}
}
}
else
{
if(y==0)
{
document.writeln("Negative X-Axis")
}
else
{
if(y>0)
{
document.writeln("II-Quad")
}
else
{
document.writeln("III-Quad")
}
}
}
}
</script>
<noscript>
Ur Browser doesn't support JavaScript
</noscript>
</body>
</html>

No comments:

Post a Comment