from part 6 to 9 Create a simple web page that contains exac
Solution
<html>
<head>
<title> Sample HTML Page </title>
<script>
function changehStrongEleStyle(ele) {
ele.style.background = \'pink\';
ele.style.fontSize = \'22px\';
}
function changeh2p2Style() {
document.getElementById(\'hdr12\').style.color = \'Goldenrod\';
document.getElementById(\'p2\').style.color = \'Goldenrod\'
}
function changestyleOnOver(ele) {
ele.style.color = \'black\';
ele.style.background = \'yellow\';
}
function changestyleOnleave(ele) {
ele.style.color = \'cyan\';
ele.style.background = \'white\';
}
function changeP3Style() {
document.getElementById(\'p3\').style.background = \'grey\';
document.getElementById(\'p3\').style.fontSize = \'20px\';
}
function promptH2(ele) {
var color = prompt(\"Please enter Color\", \"\");
if (color != null) {
if(ele.id == \'hdr21\') {
ele.style.color= color;
} else {
ele.style.background= color;
}
}
}
function change3Style(ele) {
document.getElementById(\'hdr14\').style.border = \'1px solid powderblue\';
document.getElementById(\'hdr14\').style.fontfamily = \'verdana\';
document.getElementById(\'hdr14\').style.padding = \'30px\';
document.getElementById(\'hdr24\').style.border = \'1px solid blue\';
document.getElementById(\'hdr24\').style.fontfamily = \'Tahoma\';
document.getElementById(\'hdr24\').style.padding = \'25px\';
ele.style.backgroundImage = \'url(\"\")\'; // provide Your Image URL in double quotes
}
</script>
<style type=\"text/css\">
h1 {
color :green;
}
h2 {
color : red;
}
h3 {
color : blue;
}
div {
color : cyan;
}
p {
color : black;
}
em {
color : orange;
}
strong {
color : skyblue;
}
</style>
</head>
<body>
<h1 id=\'hdr11\'>Header1 Element - one</h1>
<h1 onmouseover=\'changeh2p2Style()\' id=\'hdr12\'>Header1 Element - Two</h1>
<h1 id=\'hdr13\'>Header1 Element - Three</h1>
<h1 id=\'hdr14\'>Header1 Element - Four</h1>
<h2 id=\'hdr21\' onclick=promptH2(this)>Header2 Element - one</h2>
<h2 id=\'hdr22\' onclick=promptH2(this)>Header2 Element - Two</h2>
<h2 id=\'hdr23\'>Header2 Element - Three</h2>
<h2 id=\'hdr24\'>Header2 Element - Four</h3>
<h3 id=\'hdr31\'>Header3 Element - one</h3>
<h3 id=\'hdr32\'>Header3 Element - Two</h3>
<h3 id=\'hdr33\'>Header3 Element - Three</h3>
<h3 id=\'hdr34\' onmouseleave = change3Style(this)>Header3 Element - Four</h3>
<div id=\'div1\'> Div 1 </div>
<div id=\'div2\' onmouseover = changestyleOnOver(this) onmouseleave= changestyleOnleave(this)> Div 2 </div>
<div id=\'div3\'> Div 3 </div>
<div id=\'div4\'> Div 4 </div>
<p id=\'p1\' onClick = \'changeP3Style()\'> Paragraph 1 </p>
<p id=\'p2\'> Paragraph 2 </p>
<p id=\'p3\'> Paragraph 3 </p>
<p id=\'p4\'> Paragraph 4 </p>
<em id=\'em1\'> Emphasized Text 1 </em> <br>
<em id=\'em2\'> Emphasized Text 2 </em><br>
<em id=\'em3\'> Emphasized Text 3 </em><br>
<em id=\'em4\'> Emphasized Text 4 </em><br><br>
<strong id=\'str1\' onmouseover = changehStrongEleStyle(this)> strong Text 1 </strong><br>
<strong id=\'str2\' onmouseover = changehStrongEleStyle(this)> strong Text 2 </strong><br>
<strong id=\'str3\' onmouseover = changehStrongEleStyle(this)> strong Text 3 </strong><br>
<strong id=\'str4\' onmouseover = changehStrongEleStyle(this)> strong Text 4 </strong><br>
</body>
</html>

