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).
<html>
<head>
<title>WT
Lab Experiment-4</title>
<style>
#cc
{
color:
red;
font: 20px verdana;
font-weight: bold;
}
</style>
<script>
function
getCapital()
{
var
x;
x
= parseInt(document.getElementById("c").value);
switch(x)
{
case
1: document.getElementById("cc").value = "New Delhi";
break;
case
2: document.getElementById("cc").value = "Mascow"; break;
case
3: document.getElementById("cc").value = "Nairobi"; break;
case
4: document.getElementById("cc").value = "Beizing"; break;
case 5: document.getElementById("cc").value
= "Koulalumpur";
break;
}
}
</script>
</head>
<body>
<form
name="f1" method="get">
<b><br><br>
Select
Country : <select id="c" name="c"
onChange=getCapital()>
<option>-
Select Country -</option>
<option
value="1">India</option>
<option
value="2">Rassia</option>
<option
value="3">Kenya</option>
<option
value="4">China</option>
<option
value="5">Singapur</option>
</select><br><br><br><br>
Capital
City : <input type="label" id="cc" name="cc"
width="30"/>
</b>
</form>
</body>
</html>
output
For more info regarding technology and pro stuff...visit http://peoplezmind.com/
Comments
Post a Comment