I am very new to Javascript and I am encountering this issue when I am writing two functions:
function playVid()
{
var vid = document.getElementById("myVideo")
vid.play()
vid.muted = true
}
function colorchange()
{
document.getElementById("maindiv").style.background-color = red
}
The error I am getting is:
SyntaxError: invalid assignment left-hand sideReferenceError: playVid is not defined onload@/:1:1
The function throws no error when I remove the second function. This is my HTML code:
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body onload= "playVid()">
<div mouseover = "colorchange()" id ="maindiv">
<video id="myVideo" width="520" height="276">
<source
src="https://cdn.glitch.me/0602af0a-36e2-436b-b41e-6a4a0bb25fee%2FCreating%20controls%20for%20your%20player%20.mov?v=16377041784186"
type="video/mp4"
/>
</video>
</div>
<script src="script.js"></script>
</body>
</html>