Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Dynamic foreground and background colors, Assignments of Web Programming and Technologies

Illustrates dynamic foreground and background colors

Typology: Assignments

2019/2020

Uploaded on 12/05/2020

varsh
varsh 🇮🇳

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1.Illustrates dynamic foreground and background colors
<html>
<head>
<title>Dynamic colors</title>
<script type ="text/javascript" src = "dynColors.js" >
</script>
</head>
<body>
<p style="font-family:Times;font-style:italic;font-size:24pt">
This small page illustrates dynamic setting of the foreground and background colors for a
document
</p>
<form action=" ">
<p>
<lable>
Foreground color;
<input type="text" name ="foreground" size="10"
onchange="setColor('foreground',this.value)"/>
</label>
<br/>
<label>
Background color;
<input type="text" name="background" size="10"
onchange="setColor('background',this.value)"/>
</label>
<br/>
</p>
</form>
</body>
</html>
dynColors.js:
function setColor(where,newColor){
if(where=="background"){
document.body.style.backgroundColor = newColor;
}
else
{
document.body.style.color=newColor;
}
}
output:
pf2

Partial preview of the text

Download Dynamic foreground and background colors and more Assignments Web Programming and Technologies in PDF only on Docsity!

1.Illustrates dynamic foreground and background colors

Dynamic colors

This small page illustrates dynamic setting of the foreground and background colors for a document

Foreground color;

dynColors.js:

function setColor(where,newColor){ if(where=="background"){ document.body.style.backgroundColor = newColor; } else { document.body.style.color=newColor; } }

output: