JavaScript Input Based Background Change?
<p>My function used to work, but now it won't. I'm trying to add an if statement for when the input is left blank, it returns to the default background color.</p>

<pre><code>var path = /^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/g;

function col(obj) {
    var val = obj.value;
    if (path.test(val)) {
        document.body.style.backgroundColor = '#' + val;
    }
}

window.onload = function () {
    document.getElementById('bgcol').onkeyup = function () {
        col(this);
    }
    if (getElementById('bgcol'.value = null || ""){
    document.body.style.backgroundColor = '#000000';
}
}
</code></pre>

<p>//end javascript, begin html below</p>

<pre><code> &lt;input id="bgcol" placeholder="enter hexadecimal color"&gt;&lt;/input&gt;
</code></pre>
