mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
27 lines
469 B
HTML
27 lines
469 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
.democlass {
|
|
color: red;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<h1>Hello World</h1>
|
|
|
|
<p>Click the button to add a class attribute with the value of "democlass" to the h1 element.</p>
|
|
|
|
<button onclick="myFunction()">Try it</button>
|
|
|
|
<script>
|
|
function myFunction() {
|
|
document.getElementsByTagName("H1")[0].setAttribute("class", "democlass");
|
|
window.alert(document.getElementsByTagName("HTML")[0].outerHTML);
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|