Lecture 34

 Index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <button onclick="changecolor()">Click me</button>
    <p align="center" id="h">
        <b> CV </b>
    </p>


    <script src="js/script.js"></script>
</body>

</html>

Script.js


let h2 = document.getElementById("h")


// console.log(h2.innerText)


// h2.innerText = "Bilal javed"
// console.log(h2.innerText)



console.log(h2.innerHTML)


function changecolor() {
    let hstyle = h2.style

    h2.innerText = "<center> this is changed text </center>"


    hstyle.color = "red"
    hstyle.backgroundColor = "black"
    hstyle.height = "300px"
   
}


Comments