Question

In: Computer Science

Q: Provide JavaScript code to change the font family of the first h1 heading in the...

Q: Provide JavaScript code to change the font family of the first h1 heading in the document to Arial?

Solutions

Expert Solution

font.html

<!DOCTYPE html>
<html>
<head>
   <title>font</title>
   <script type="text/javascript">
       function fun(argument) {
           // body...
           document.getElementById("first").style.fontFamily = "Arial";   //get heading by id and set the font family style to Arial
           //alert("Hello");
       }
   </script>
</head>
<body>
<h1 id="first">Heading 1</h1>

<h1 id="second">Heading 2</h1>
<button onclick="fun()">click to change font</button>
</body>
</html>

OUTPUT:

if you have any doubts please COMMENT....

If you understand the answer please give THUMBS UP...


Related Solutions

For the following style rules, what is the font size of the h1 heading in pixels?...
For the following style rules, what is the font size of the h1 heading in pixels? body {font-size: 16px;} body > article {font-size: 0.75em;} body > article > h1 {font-size: 1.5em;} 16px; 12px; 18px; 18.25px;
provide a JavaScript code that finds if the given word by user (prompt) is a Palindrome...
provide a JavaScript code that finds if the given word by user (prompt) is a Palindrome or no.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT