Friday, 13 April 2018

WT-Slip23

23)Design HTML page to read the value for n. Write a PHP script to display first n even numbers with font size = 12 and color = red and first n odd numbers with  font face = Times new Roman , size = 17 & color = yellow.
                                                                                                                            

<html>
<head>
<style type="text/css">

.even
{
font-size:12px;
color:red;
}

.odd
{
font-family:"Times New Roman";
font-size:17px;
color:yellow;
}

body
{
background-color=007;
}

</style>
</head>
<body>
<?php
if($_GET)
{
$n=(int)$_GET['number'];
$even=2;
$odd=1;

for($i=0;$i<$n;$i++)
{
echo "<a class='even'>".$even."</a><br>";
$even=$even+2;
}
echo "<br>";
for($i=0;$i<$n;$i++)
{
echo "<a class='odd'>".$odd."</a><br>";
$odd=$odd+2;
}
}
?>
<form>
<input type="text"name="number">
<input type="submit">
</form>
</body>
</html>