You are on page 1of 4

Practical 5.

HTML
<!-- Shaikh Abdullah -->
<!DOCTYPE html>
<html>
    <head>
        <title>select city</title>
        <script src="pr5_1.js" defer></script>
    </head>
    <body>
        <form id="form">
        <select name="city" id="city" onchange="city_info()">
            <option value="Delhi">Delhi</option>
            <option value="Mumbai">Mumbai</option>
            <option value="Bangalore">Bangalore</option>
        </select>
        <br/>
        <textarea name="" id="info" cols="30" rows="10">
        </textarea>
        </form>
    </body>
</html>

JAVASCRIPT
// 1705690080
function city_info()
{
var city = document.getElementById("city").value
var text = document.getElementById("info");

if(city=="Delhi"){
    text.value="This is Delhi";
}
else if(city=="Mumbai"){
    text.value="This is Mumbai";
}
else{
    text.value="This is Bangalore";
}
}
OUTPUT
Practical 5.2

HTML
<!-- Shaikh Abdullah -->
<!DOCTYPE html>
<html>
    <head>
    <title></title>
    <script src="pr5_2.js" defer></script>
    </head>
    <body>
        <h4>Shaikh Abdullah</h4>
    <input id="red" value="Red" type="Radio"  name="color"
onchange="change_color(this.value)"/>RED
    <input id="green" value="green" type="Radio" name="color"
onchange="change_color(this.value)" />GREEN
    <input id="blue" value="blue" type="Radio" name="color"
onchange="change_color(this.value)"/>BLUE
    </body>
</html>

JAVASCRIPT
// 1705690080
function change_color(val)
{
    document.bgColor=val;
}

OUTPUT

You might also like