The question is as follows: Create a web page in which the user is allowed to se
ID: 3567128 • Letter: T
Question
The question is as follows: Create a web page in which the user is allowed to select the the page's background color and whether the page uses serif or sans-serif fonts. Then change the body element's style attribute accordingly.
The professor has asked for us to follow an example in the book which has a .html file and a seperate .js file. I have written both but I cannot get the function in the .js file to load correctly. It changes the background color first but when it changes the text the background color goes away.
If you think you can help me I will paste my files here.
Thanks in advance!
Explanation / Answer
<!DOCTYPE html>
<!-- Assignment 12.6: Objects and Collections -->
<html>
<head>
<meta charset = "utf-8">
<title>Webpage</title>
</head>
<body>
<a href="#">Click Blue</a>
<a href="#">Click Red</a>
<a href="#">Click Green</a>
<br>
<a href="#" Make it Serif!!!</a>
<a href="#" Make it SansSerif!!!</a>
<p id='para'> Sample Text
<br>
<a href="#">Click Serif</a>
<a href="#">Click Sans Serif</a>
<script type = "text/javascript">
function changeBGC(color)
{
document.bgColor = color;
}
function changeFont(whichType)
{
document.font-family = whichType;
}
</script>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.